Last modified by bougault on 2022/03/02 11:58

From version 26.1
edited by allan
on 2020/03/10 13:46
Change comment: There is no comment for this version
To version 30.1
edited by mmorgan
on 2020/07/16 00:45
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.allan
1 +XWiki.mmorgan
Content
... ... @@ -4,22 +4,22 @@
4 4  
5 5  == Becoming a contributor ==
6 6  
7 -The first step is for you to **get the developer accreditation**. Contributors can register and manage applications within the Community Apps Catalogue.
7 +The first step is for you to **get the developer accreditation**. Contributors can register and manage apps within the Community Apps Catalogue.
8 8  
9 -Send an email to [[support@ebrains.eu>>mailto:support@ebrains.eu]] with a short summary of your intentions.
9 +Send an email to [[support@ebrains.eu>>mailto:support@ebrains.eu]] with a short motivation for your request.
10 10  
11 -The support team will apply the permissions to your user: your account will be [[upgraded with developers privileges>>doc:Collabs.collab-devs.collaboratory-v2.keycloak.user administration.WebHome]] the next time you will login.
11 +The support team will apply the permissions to your user. Your account will be [[upgraded with developer privileges>>doc:Collabs.collab-devs.collaboratory-v2.keycloak.user administration.WebHome]] the next time you login.
12 12  
13 13  (% class="box infomessage" %)
14 14  (((
15 -Only SGA2 accredited users will be automatically granted the developer accreditation.
15 +Only SGA3 accredited users will be automatically granted the developer accreditation.
16 16  )))
17 17  
18 18  == Making your app available to users ==
19 19  
20 -In order for you application to be installable by users, it needs to be registered within the [[Community Apps Catalogue>>doc:Apps.WebHome]].
20 +In order for users to install your app, it needs to be registered in the [[Community Apps Catalogue>>doc:Apps.WebHome]].
21 21  
22 -Once this simple step is complete, users will be able to install your app within their collabs.
22 +If you are dealing with private data, or your users need to be authenticated, see [[authentication and authorization in the Collaboratory.>>doc:Collabs.the-collaboratory.Technical documentation.Architecture.Permissions.Authentication & Authorisation using OIDC.WebHome]]
23 23  
24 24  === Registering an application in the Catalogue ===
25 25  
... ... @@ -27,44 +27,44 @@
27 27  
28 28  Fill the form with the following information:
29 29  
30 -* **main URL**: the URL of the homepage of your app. This is where user will be directed when then open your app in a collab.
31 -* **settings URL**: the URL of the your settings management page if you have one.
32 -* **description**: a description of what your app does to help users select it.
33 -* **under development?**: should be checked if you don't want your app to be available by default by other users.
34 -* **category**: a category to help structuring the applications.
35 -* **maintainers**: a list of users who maintain the app. The users need to have logged in the wiki at least once to be found. Maintainers are granted the right to modify an app registration.
30 +* **main URL**: the URL of the homepage of your app. This is where the users will be directed when they open your app in a collab.
31 +* **settings URL**: the URL of your app's settings management page, if there is one.
32 +* **description**: a description of what your app does. This helps users choose the apps they install.
33 +* **under development?**: if checked, your app will not be available to other users.
34 +* **category**: a category to help structure the list of apps.
35 +* **maintainers**: a list of users who maintain the app. The users need to have logged in the wiki at least once to appear on the list. Maintainers are granted the right to modify the app's registration.
36 36  * **documentation URL**: if your app has online user documentation, a link will be provided to users when they use your app.
37 -* **repository**: a URL to a public repository so users can check the sources of your app.
37 +* **repository**: a URL to a public repository so users can access the source code of your app.
38 38  
39 39  Click on **Save**. Your app is now registered and waiting for users to install it!
40 40  
41 41  === Installing your app in a collab ===
42 42  
43 -1. In order to install your app, you need to navigate to a collab where you have either the **editor** or **administrator** role.
44 -1. Click on **Create**. Enter a title for this instance of your app and select **Community App** in the right selector.
45 -1. Click on **Create**. You will be presented with the Community App Catalogue. The app you will see are the public apps and the ones your a maintainer of.
43 +1. In order to install your app, you need to navigate to a collab where you have either the **editor** or **admin** role.
44 +1. Click on **Create** at the top right to create a new entry in the navigation pane under the current wiki page. Enter a title for this instance of your app and select **Community App** in the right selector.
45 +1. Click on **Create**. You will be presented with the Community App Catalogue. The apps you will see are the public apps and the ones for which you are a maintainer.
46 46  1. Select your app and click on **Save and View**.
47 47  
48 -You should now see how your app looks like within a collab.
48 +You should now see your app in your collab just as other users will see it.
49 49  
50 50  == Getting your app instance context ==
51 51  
52 -Instances of your applications will be installed by collab authors in many different collabs. In order to let you customise the user experience based on its context, the Collaboratory will automatically pass query parameters to your app:
52 +Instances of your apps will be installed by collab owners in many different collabs. In order to let you customise the user experience based on its context, the Collaboratory will automatically pass query parameters to your app:
53 53  
54 54  * **##clb-collab-id##**: the unique, human-readable identifier of the collab.
55 -* ##**clb-doc-path**##: the path of your app instance within the collab. If your app is at the root of a collab, this value will be empty.
55 +* ##**clb-doc-path**##: the (relative) path to your app instance within the collab. If your app is at the root of a collab, this value will be empty.
56 56  * ##**clb-doc-name**##: the name of the document where your app instance is installed.
57 57  * ##**clb-drive-id**##: the unique identifier of the drive of the collab. This id is required if you want to fetch or store documents within the drive of the collab.
58 58  
59 59  == App settings ==
60 60  
61 -The app settings are the values the collab author can modify to change the behaviour of your application within her collab.
61 +The app settings are the values the collab owners can modify to change the behaviour of your app within their collabs.
62 62  
63 63  === Writing settings ===
64 64  
65 -The Collaboratory comes with a mechanism to let your app store these settings directly in the Collaboratory.
65 +The Collaboratory comes with a mechanism to let your app store its settings directly in the Collaboratory.
66 66  
67 -In order to do that, your app needs to use the [[postMessage javascript API>>https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage]] to send the settings to store to the Collaboratory:
67 +In order to do that, your app needs to use the [[postMessage javascript API>>https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage]] to send the settings to be stored in the Collaboratory:
68 68  
69 69  {{code language="javascript"}}
70 70  window.parent.postMessage({
... ... @@ -77,177 +77,10 @@
77 77   }}, 'https://wiki.ebrains.eu');
78 78  {{/code}}
79 79  
80 -=== Fetching settings ===
80 +=== Reading settings ===
81 81  
82 82  The Collaboratory will get the settings from its key/value store and pass them to your app through query parameters.
83 83  
84 84  == Creating your OpenID Connect client ==
85 85  
86 -The steps to create an OpenID Connect client are the following:
87 -
88 -1. get an access token from the `developer` client
89 -1. use the token to call the create endpoint
90 -1. save your registration access token for further modifications of your client
91 -
92 -Note that a [[notebook>>https://lab.ebrains.eu/user-redirect/lab/tree/drive/Shared%20with%20all/Collaboratory%20Community%20Apps/Managing%20an%20OpenID%20Connect%20client.ipynb||rel="noopener noreferrer" target="_blank"]] is available to help you create and modify your OIDC client.
93 -
94 -=== Fetching your developer access token ===
95 -
96 -Getting your developer token is done in one simple step: authenticate against the developer client with the password grant.
97 -
98 -This can be achieved with this sample shell script:
99 -
100 -{{code language="bash"}}
101 -# Gather username and password from user
102 -echo '\nEnter your username' && read clb_dev_username &&
103 -echo '\nEnter your password' && read -s clb_dev_pwd &&
104 -
105 -# Fetch the token
106 -curl -X POST https://iam.ebrains.eu/auth/realms/hbp/protocol/openid-connect/token \
107 - -u developer: \
108 - -d 'grant_type=password' \
109 - --data-urlencode "username=${clb_dev_username}" \
110 - --data-urlencode "password=${clb_dev_pwd}" |
111 -
112 -# Prettify the JSON response
113 -json_pp;
114 -
115 -# Erase the credentials from local variables
116 -clb_dev_pwd='';clb_dev_username=''
117 -{{/code}}
118 -
119 -The response will be similar to:
120 -
121 -{{code language="json"}}
122 -{
123 - "access_token": "eyJhbGci...",
124 - "expires_in": 108000,
125 - "refresh_expires_in": 14400,
126 - "refresh_token": "eyJhbGci...",
127 - "token_type": "bearer",
128 - "not-before-policy": 1563261088,
129 - "session_state": "0ac3dfcd-aa5e-42eb-b333-2f73496b81f8",
130 - "scope": ""
131 -}
132 -{{/code}}
133 -
134 -Copy the "access_token" value, you will need if for the next step.
135 -
136 -=== Creating the client ===
137 -
138 -You can now create clients by sending a JSON representation to a specific endpoint:
139 -
140 -{{code language="bash"}}
141 -# Set your developer token
142 -clb_dev_token=...
143 -
144 -# Send the creation request
145 -curl -X POST https://iam.ebrains.eu/auth/realms/hbp/clients-registrations/default/ \
146 - -H "Authorization: Bearer ${clb_dev_token}" \
147 - -H 'Content-Type: application/json' \
148 - -d '{
149 - "clientId": "my-awesome-client",
150 - "name": "My Awesome App",
151 - "description": "This describes what my app is for end users",
152 - "rootUrl": "https://root.url.of.my.app",
153 - "baseUrl": "/relative/path/to/its/frontpage.html",
154 - "redirectUris": [
155 - "/relative/redirect/path",
156 - "/these/can/use/wildcards/*"
157 - ],
158 - "webOrigins": ["+"],
159 - "bearerOnly": false,
160 - "consentRequired": true,
161 - "standardFlowEnabled": true,
162 - "implicitFlowEnabled": true,
163 - "directAccessGrantsEnabled": false,
164 - "attributes": {
165 - "contacts": "first.contact@example.com; second.contact@example.com"
166 - }
167 - }' |
168 -
169 -# Prettify the JSON response
170 -json_pp;
171 -{{/code}}
172 -
173 -In case of success, the endpoint will return its representation of your client:
174 -
175 -{{code language="json"}}
176 -{
177 - "defaultClientScopes" : [
178 - "web-origins",
179 - "roles"
180 - ],
181 - "redirectUris" : [
182 - "/relative/redirect/path",
183 - "/these/can/use/wildcards/*"
184 - ],
185 - "nodeReRegistrationTimeout" : -1,
186 - "rootUrl" : "https://root.url.of.my.app",
187 - "webOrigins" : [
188 - "+"
189 - ],
190 - "authenticationFlowBindingOverrides" : {},
191 - "baseUrl" : "/relative/path/to/its/frontpage.html",
192 - "description" : "This describes what my app is for end users",
193 - "notBefore" : 0,
194 - "frontchannelLogout" : false,
195 - "enabled" : true,
196 - "registrationAccessToken" : "eyJhbGciOi...",
197 - "consentRequired" : true,
198 - "fullScopeAllowed" : false,
199 - "clientAuthenticatorType" : "client-secret",
200 - "surrogateAuthRequired" : false,
201 - "directAccessGrantsEnabled" : false,
202 - "standardFlowEnabled" : true,
203 - "id" : "551b49a0-ec69-41af-9461-6c10fbc79a35",
204 - "attributes" : {
205 - "contacts" : "first.contact@example.com; second.contact@example.com"
206 - },
207 - "name" : "My Awesome App",
208 - "secret" : "your-client-secret",
209 - "publicClient" : false,
210 - "clientId" : "my-awesome-client",
211 - "optionalClientScopes" : [],
212 - "implicitFlowEnabled" : true,
213 - "protocol" : "openid-connect",
214 - "bearerOnly" : false,
215 - "serviceAccountsEnabled" : false
216 -}
217 -{{/code}}
218 -
219 -Among all the attributes, you should securely save:
220 -
221 -* your client **secret** ("secret" attribute): it is needed by your application to **authenticate to the IAM server** when making backend calls
222 -* your client **registration access token** ("registrationAccessToken"): you will need it to authenticate when **modifying your client in the future**
223 -
224 -=== Modifying your client ===
225 -
226 -Update your client with a PUT request:
227 -
228 -{{code language="bash"}}
229 -# Set your registration token and client id
230 -clb_reg_token=...
231 -
232 -# Update the client
233 -curl -X PUT https://iam.ebrains.eu/auth/realms/hbp/clients-registrations/default/my-awesome-client \
234 - -H "Authorization: Bearer ${clb_reg_token}" \
235 - -H 'Content-Type: application/json' \
236 - -d '{
237 - "clientId": "my-awesome-client",
238 - "redirectUris": [
239 - "/relative/redirect/path",
240 - "/these/can/use/wildcards/*",
241 - "/a/new/redirect/uri"
242 - ]
243 - }' |
244 -
245 -# Prettify the JSON response
246 -json_pp;
247 -{{/code}}
248 -
249 - Note that your need to provide your client id both in the endpoint URL and within the body of the request.
250 -
251 -{{warning}}
252 -/!\ ** 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.   **/!\
253 -{{/warning}}
86 +See the instructions [[here>>doc:.Registering an OIDC client.WebHome]].