forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-committed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
47 lines
5.4 KiB
HTML
47 lines
5.4 KiB
HTML
<a name="dli_09_0121"></a><a name="dli_09_0121"></a>
|
|
|
|
<h1 class="topictitle1">Performing Authentication</h1>
|
|
<div id="body8662426"><div class="section" id="dli_09_0121__en-us_topic_0093946854_section2073076515120"><h4 class="sectiontitle">Scenario</h4><p id="dli_09_0121__en-us_topic_0093946854_p2214320115124">You need to be authenticated when using JDBC to create DLI driver connections.</p>
|
|
</div>
|
|
<div class="section" id="dli_09_0121__en-us_topic_0093946854_section18149062151222"><h4 class="sectiontitle">Procedure</h4><p id="dli_09_0121__en-us_topic_0093946854_p2577325517947">Currently, the JDBC supports authentication using the Access Key/Secret Key (AK/SK) or token.</p>
|
|
<ul id="dli_09_0121__en-us_topic_0093946854_ul16758061123310"><li id="dli_09_0121__en-us_topic_0093946854_li66078932151559">(Recommended) Generating an AK/SK<ol id="dli_09_0121__en-us_topic_0093946854_ol50793300151559"><li id="dli_09_0121__en-us_topic_0093946854_li54486522151559">Log in to the DLI management console.</li><li id="dli_09_0121__en-us_topic_0093946854_li20616653151559">Click the username in the upper right corner and select <span class="uicontrol" id="dli_09_0121__uicontrol6520707591112"><b>My Credentials</b></span> from the drop-down list.</li><li id="dli_09_0121__en-us_topic_0093946854_li59336166151559">On the displayed <span class="uicontrol" id="dli_09_0121__uicontrol805792508184342"><b>My Credentials</b></span> page, click <span class="wintitle" id="dli_09_0121__wintitle37956610151559"><b>Access Keys</b></span>. By default, the <span class="wintitle" id="dli_09_0121__wintitle4955132514402"><b>Project List</b></span> page is displayed.</li><li id="dli_09_0121__en-us_topic_0093946854_li6065177151559">Click <span class="uicontrol" id="dli_09_0121__uicontrol54586595151559"><b>Add Access Key</b></span>. In the displayed <strong id="dli_09_0121__b842352706184524">Add Access Key</strong> dialog box, specify <span class="parmname" id="dli_09_0121__parmname1729726471184548"><b>Login Password</b></span> and <span class="parmname" id="dli_09_0121__parmname822559648184548"><b>SMS Verification Code</b></span>.</li><li id="dli_09_0121__en-us_topic_0093946854_li21517315151559">Click <span class="uicontrol" id="dli_09_0121__uicontrol59438113151559"><b>OK</b></span> to download the certificate.</li><li id="dli_09_0121__en-us_topic_0093946854_li65180974151559">After the certificate is downloaded, you can obtain the AK and SK information in the <strong id="dli_09_0121__b5202851719139">credentials</strong> file.</li></ol>
|
|
<div class="note" id="dli_09_0121__note196905137167"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="dli_09_0121__p414493171019">Hard coding AKs and SKs or storing them in code in plaintext poses significant security risks. You are advised to store them in encrypted form in configuration files or environment variables and decrypt them when needed to ensure security.</p>
|
|
</div></div>
|
|
</li><li id="dli_09_0121__en-us_topic_0093946854_li66327556123310">Obtain the token.<p id="dli_09_0121__en-us_topic_0093946854_p758818412234"><a name="dli_09_0121__en-us_topic_0093946854_li66327556123310"></a><a name="en-us_topic_0093946854_li66327556123310"></a>When using token authentication, you need to obtain the user token and configure the token information in the JDBC connection parameters. You can obtain the token as follows:</p>
|
|
<ol id="dli_09_0121__en-us_topic_0093946854_ol1120012248335"><li id="dli_09_0121__en-us_topic_0093946854_li920012483318">Send <i><b><span class="cmdname" style="font-family:Arial" id="dli_09_0121__en-us_topic_0093946854_cmdname1854033311311">POST https://<IAM_Endpoint>/v3/auth/tokens</span></b></i>. To obtain the IAM endpoint, contact the administrator to obtain the region and endpoint information.<div class="p" id="dli_09_0121__en-us_topic_0093946854_p120019249335">An example request message is as follows:<div class="note" id="dli_09_0121__en-us_topic_0093946854_note1420019242332"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="dli_09_0121__en-us_topic_0093946854_p820014246337">Replace content in italic in the sample code with the actual values. For details, see .</p>
|
|
</div></div>
|
|
<pre class="screen" id="dli_09_0121__en-us_topic_0093946854_screen20200132433310">{
|
|
"auth": {
|
|
"identity": {
|
|
"methods": [
|
|
"password"
|
|
],
|
|
"password": {
|
|
"user": {
|
|
"name": "<em id="dli_09_0121__en-us_topic_0093946854_i7200124103310">username</em>",
|
|
"password": "<em id="dli_09_0121__en-us_topic_0093946854_i18200024203314">password</em>",
|
|
"domain": {
|
|
"name": "<em id="dli_09_0121__en-us_topic_0093946854_i1420032415330">domainname</em>"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"scope": {
|
|
"project": {
|
|
"id": "0aa253a31a2f4cfda30eaa073fee6477" //Assume that <strong id="dli_09_0121__b3786124883116">project_id</strong> is <strong id="dli_09_0121__b478614480313">0aa253a31a2f4cfda30eaa073fee6477</strong>.
|
|
}
|
|
}
|
|
}
|
|
}</pre>
|
|
</div>
|
|
</li><li id="dli_09_0121__en-us_topic_0093946854_li07732031141510">After the request is processed, the value of <span class="parmvalue" id="dli_09_0121__parmvalue860919211214"><b>X-Subject-Token</b></span> in the response header is the token value.</li></ol>
|
|
</li></ul>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dli_09_0123.html">Submitting a Spark SQL Job Using JDBC</a></div>
|
|
</div>
|
|
</div>
|
|
|