Changes for page 1. Registering an OIDC client
Last modified by messines on 2022/05/25 10:11
Summary
-
Page properties (3 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 - 1.Registering an OIDC client1 +Registering an OIDC client - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. messines1 +XWiki.villemai - Content
-
... ... @@ -1,38 +17,13 @@ 1 -== Must read before starting == 2 - 3 -It's very important to choose the right type of clients and to understand the various OAuth flows. 4 - 5 -A very good documentation is this one : 6 - 7 -[[https:~~/~~/auth0.com/docs/authorization/which-oauth-2-0-flow-should-i-use>>url:https://auth0.com/docs/authorization/which-oauth-2-0-flow-should-i-use]] 8 - 9 -and another one 10 - 11 -[[https:~~/~~/dzone.com/articles/the-right-flow-for-the-job-which-oauth-20-flow-sho>>url:https://dzone.com/articles/the-right-flow-for-the-job-which-oauth-20-flow-sho]] 12 - 13 -Also a live exemple of client ID creation is available here on our lab, you can perfectly use this notebook to create your client, the next steps in this documentation reproduce the content of the notebook. 14 - 15 -[[https:~~/~~/lab.ebrains.eu/user/user-redirect/lab/tree/shared/Collaboratory%20Community%20Apps/Managing%20an%20OpenID%20Connect%20client.ipynb>>https://lab.ebrains.eu/user/user-redirect/lab/tree/shared/Collaboratory%20Community%20Apps/Managing%20an%20OpenID%20Connect%20client.ipynb]] 16 - 17 17 == Creating your OpenID Connect client == 18 18 19 -The steps to create an OpenID Connect (OIDC)client are the following:3 +The steps to create an OpenID Connect client are the following: 20 20 21 -1. Ask the developer accreditation to be authorize to create client 22 22 1. get an access token from the `developer` client 23 -1. save your registration access token for further modifications of your client 24 24 1. use the token to call the create endpoint 7 +1. save your registration access token for further modifications of your client 25 25 26 -Note that a Jupyter Notebooknotebookisavailable intheDriveof this collabtohelp you create and modifyyour OIDC client. Itsname is: **//Managing//**[add link]9 +Note that a [[notebook>>url:https://lab.ebrains.eu/user-redirect/lab/tree/drive/Shared%20with%20all/Collaboratory%20Community%20Apps/Managing%20an%20OpenID%20Connect%20client.ipynb]] is available to help you create and modify your OIDC client. 27 27 28 -=== Ask for developer accreditation === 29 - 30 -To be authorize to create an OIDC client you have to be accredited as developer. 31 - 32 -Please go on this page and "Request to join" the group [[https:~~/~~/wiki.ebrains.eu/bin/view/Identity/#/groups/app-collaboratory-iam~~-~~-service-providers>>https://wiki.ebrains.eu/bin/view/Identity/#/groups/app-collaboratory-iam--service-providers]] 33 - 34 -We will quickly process your request and you will be able to create an OIDC client 35 - 36 36 === Fetching your developer access token === 37 37 38 38 Getting your developer token is done in one simple step: authenticate against the developer client with the password grant. ... ... @@ -41,8 +41,8 @@ 41 41 42 42 {{code language="bash"}} 43 43 # Gather username and password from user 44 - read-p'Enter your username:' clb_dev_username45 - read-s -p'Enter your password:' clb_dev_pwd19 +echo '\nEnter your username' && read clb_dev_username && 20 +echo '\nEnter your password' && read -s clb_dev_pwd && 46 46 47 47 # Fetch the token 48 48 curl -X POST https://iam.ebrains.eu/auth/realms/hbp/protocol/openid-connect/token \ ... ... @@ -50,12 +50,12 @@ 50 50 -d 'grant_type=password' \ 51 51 --data-urlencode "username=${clb_dev_username}" \ 52 52 --data-urlencode "password=${clb_dev_pwd}" | 28 + 29 +# Prettify the JSON response 30 +json_pp; 53 53 54 -# and pretty-print the JSON response 55 -json_pp 56 - 57 57 # Erase the credentials from local variables 58 -clb_dev_pwd=''; 33 +clb_dev_pwd='';clb_dev_username='' 59 59 {{/code}} 60 60 61 61 The response will be similar to: ... ... @@ -73,7 +73,7 @@ 73 73 } 74 74 {{/code}} 75 75 76 - Store a copyofthe "access_token" value.You will need if for the next step.51 +Copy the "access_token" value, you will need if for the next step. 77 77 78 78 === Creating the client === 79 79 ... ... @@ -81,7 +81,7 @@ 81 81 82 82 {{code language="bash"}} 83 83 # Set your developer token 84 -clb_dev_token= "eyJhbGci..."59 +clb_dev_token=... 85 85 86 86 # Send the creation request 87 87 curl -X POST https://iam.ebrains.eu/auth/realms/hbp/clients-registrations/default/ \ ... ... @@ -108,7 +108,7 @@ 108 108 } 109 109 }' | 110 110 111 -# Pretty printthe JSON response86 +# Prettify the JSON response 112 112 json_pp; 113 113 {{/code}} 114 114 ... ... @@ -160,7 +160,7 @@ 160 160 161 161 Among all the attributes, you should securely save: 162 162 163 -* your client **secret** ("secret" attribute): it is needed by your application to **authenticate to the IAM server** when making back -end calls138 +* your client **secret** ("secret" attribute): it is needed by your application to **authenticate to the IAM server** when making backend calls 164 164 * your client **registration access token** ("registrationAccessToken"): you will need it to authenticate when **modifying your client in the future** 165 165 166 166 === Modifying your client === ... ... @@ -169,15 +169,14 @@ 169 169 170 170 {{code language="bash"}} 171 171 # Set your registration token and client id 172 -clb_reg_token="eyJhbGciOi..." 173 -clb_client_id="my-awesome-client" 147 +clb_reg_token=... 174 174 175 -# Update the client . Note that the client ID appears both in the endpoint URL and in the body of the request.176 -curl -X PUT https://iam.ebrains.eu/auth/realms/hbp/clients-registrations/default/ ${clb_client_id}\149 +# Update the client 150 +curl -X PUT https://iam.ebrains.eu/auth/realms/hbp/clients-registrations/default/my-awesome-client \ 177 177 -H "Authorization: Bearer ${clb_reg_token}" \ 178 178 -H 'Content-Type: application/json' \ 179 179 -d '{ 180 - "clientId": " '${clb_client_id}'",154 + "clientId": "my-awesome-client", 181 181 "redirectUris": [ 182 182 "/relative/redirect/path", 183 183 "/these/can/use/wildcards/*", ... ... @@ -185,13 +185,15 @@ 185 185 ] 186 186 }' | 187 187 188 -# Pretty print the JSON response 189 -json_pp 190 - 162 +# Prettify the JSON response 163 +json_pp; 191 191 {{/code}} 192 192 193 193 Note that your need to provide your client id both in the endpoint URL and within the body of the request. 194 194 195 195 {{warning}} 196 -** ⚠Each time you modify your client, a new registration access token isgenerated. You need to keep track of yourlatest token to keep access to your client.⚠**169 +/!\ ** Each time you modify your client, a new registration access token will be generated. You need to keep track of your token changes to keep access to your client. **/!\ 197 197 {{/warning}} 171 + 172 +(% class="wikigeneratedid" id="HH4Won27tAppearinToC" %) 173 +