Last modified by messines on 2021/06/08 17:32

From version 2.2
edited by messines
on 2020/07/15 18:03
Change comment: There is no comment for this version
To version 12.1
edited by messines
on 2020/07/15 18:44
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -6,7 +6,7 @@
6 6  
7 7  The client is confidential with a secret, you obtain it throught the registering oidc client tutorial above.
8 8  
9 -[[image:Screenshot 2020-07-15 at 17.47.12.png]]
9 +[[image:Screenshot 2020-07-15 at 17.47.12.png||height="517" width="758"]]
10 10  
11 11  
12 12  The whole authentication flow presented here is based on the official OAuth2 rfc describe in the section 4.1
... ... @@ -13,10 +13,14 @@
13 13  
14 14  [[https:~~/~~/tools.ietf.org/html/rfc6749#section-4.1>>https://tools.ietf.org/html/rfc6749#section-4.1]]
15 15  
16 +[[image:Screenshot 2020-07-15 at 18.32.14.png||height="410" width="474"]]
17 +
16 16  == Authentication flow ==
17 17  
18 18  === Authorization Code Grant ===
19 19  
22 +The first step of the authentication protocol is to fetch an **authorization code **for your client and your user
23 +
20 20  ==== Request ====
21 21  
22 22  /GET on [[https:~~/~~/iam.ebrains.eu/auth/realms/hbp/protocol/openid-connect/auth >>https://iam.ebrains.eu/auth/realms/hbp/protocol/openid-connect/auth]]
... ... @@ -39,10 +39,11 @@
39 39  
40 40  ==== Scope ====
41 41  
42 -In the request you can see a scope **parameter**
46 +In the request you can see a **scope** **parameter**
43 43  
44 44  * **openid : **This scope is required in oidc, it contains basic information of the user such as it username, email and full name.
45 -* **group **( optional ) **:**
49 +* **group **( optional ) **: **This scope is provided by our service, if you add it to your authorization code grant request, the futur access token generated will be able to read which units and groups the logged user belongs, it can be very important for your application. You can notice on the screenshot in the abstract section that **Consent required **is **on, **it means that at loggin time, the user will be asked if he allow your application to access there unit and group membership
50 +* **team **( optional ) **: **Very same than group, but for collab, with this scope your application will know in which collab the authenticated user belong
46 46  
47 47  ==== Response ====
48 48  
... ... @@ -56,4 +56,92 @@
56 56  )))
57 57  
58 58  
59 -
64 +=== Access Token Request ===
65 +
66 +==== Request ====
67 +
68 +Now that you have the **authorization** **code, **you can reach the **/token **endpoint and fetch the user access token
69 +
70 +/POST : https:/iam.ebrains.eu/auth/realms/hbp/protocol/openid-connect/token
71 +
72 +with params
73 +
74 +* grant_type : authorization_code
75 +* code : //f3f04f93-hbp-482d-ac3d-demo.turtorial.7122c1d9-3f7e-4d80-9c4f-dcd244bc2ec7//
76 +* redirect_uri : [[https:~~/~~/www.getpostman.com/oauth2/callback>>https://www.getpostman.com/oauth2/callback]]
77 +* client_id : community-apps-tutorial
78 +* client_secret : your client secret obtained during client creation
79 +
80 +[[image:Screenshot 2020-07-15 at 18.20.34.png]]
81 +
82 +
83 +==== Response ====
84 +
85 +200 OK
86 +
87 +(% class="box" %)
88 +(((
89 +{
90 + "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAi...pP5vaNwvvsaNGEA",
91 + "expires_in": 604773,
92 + "refresh_expires_in": 604773,
93 + "refresh_token": "eyJh...vC5eIR1rNhRJ4d8",
94 + "token_type": "bearer",
95 + "id_token": "eyJ...YOwdQ",
96 + "not-before-policy": 0,
97 + "session_state": "76e553bf-ba2e-45b6-8c6c-c867772b40ec",
98 + "scope": "openid"
99 +}
100 +)))
101 +
102 +You get a response containing the access token and others
103 +
104 +== Access user info ==
105 +
106 +==== Request ====
107 +
108 +Now that your application got the access token of your user, it's really easy to fetch user info
109 +
110 +(% class="box infomessage" %)
111 +(((
112 +/GET https:/iam.ebrains.eu/auth/realms/hbp/protocol/openid-connect/userinfo
113 +)))
114 +
115 +and just provide the access token as **Authorization** header
116 +
117 +[[image:Screenshot 2020-07-15 at 18.28.28.png||height="161" width="566"]]
118 +
119 +
120 +==== Response ====
121 +
122 +As response you will have a json with all the information on the logged user, for my user
123 +
124 +(% class="box" %)
125 +(((
126 +{
127 + "sub": "fa2db206-3eb4-403c-894a-810ebaba98e1",
128 + "unit": [
129 + "/collab-devs",
130 + "/collab-team",
131 + "/all/institutions/switzerland/epfl",
132 + "/all/projects/hbp/consortium/SGA2/SP05",
133 + "/all/projects/hbp/consortium/SGA3/WP6/T6_11"
134 + ],
135 + "roles": {
136 + "jupyterhub": [
137 + "feature:authenticate"
138 + ],
139 + "xwiki": [
140 + "feature:authenticate"
141 + ],
142 + "team": [
143 + "collab-collaboratory-community-apps-editor"
144 + ],
145 + "group": [
146 + "group-collaboratory-developers",
147 + "unit-all-projects-hbp-consortium-sga2-sp05-administrator"
148 + ]
149 + },
150 + "mitreid-sub": "305862"
151 +}
152 +)))
Screenshot 2020-07-15 at 18.20.34.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.messines
Size
... ... @@ -1,0 +1,1 @@
1 +273.3 KB
Content
Screenshot 2020-07-15 at 18.28.28.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.messines
Size
... ... @@ -1,0 +1,1 @@
1 +58.4 KB
Content
Screenshot 2020-07-15 at 18.32.14.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.messines
Size
... ... @@ -1,0 +1,1 @@
1 +161.8 KB
Content