OIDC support #380
Labels
No labels
bug
config
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
orinoco/shacl-vue#380
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
From @mih
Some notes on design
This is the authorization URL template for a PKCE request to the forgejo OIDC server:
We need:
YOUR-FORGEJO-URL: e.g.https://hub.psychoinformatics.de(and then the app can add/login/oauth/authorize?to it automatically)CLIENT_ID: this is the client id of the OAuth2 application created via settings in when logged into the forgejo instance. This act of creating the application also provides a client secret, but the whole point of using PKCE is to not have to use the secret in the browser.REDIRECT_URI: e.g.https://pool.psychoinformatics.de/ui/oidc-callback; any of the redirect URLs specified when creating the OAuth2 application above (new ones can be added afterwards too); this is the url that the OIDC server redirects back to once it has received the code challenge for the given clientCODE_CHALLENGE_METHOD: we will useS256because the web app can indeed compute a "URL-safe base64-encoded string of the SHA256 hash of code_verifier"CODE_CHALLENGE: this is a "URL-safe base64-encoded string of the SHA256 hash of code_verifier", which in turn "has to be a random string with a minimum length of 43 characters and a maximum length of 128 character..."STATE: "The state parameter is optional, but should be used to prevent CSRF attacks"Steps in the OIDC workflow:
loginViaOIDCfunctionloginViaOIDCfunction:YOUR-FORGEJO-URL,CLIENT_ID,REDIRECT_URI, andCODE_CHALLENGE_METHODfrom app configurationCODE_CHALLENGEbased onCODE_CHALLENGE_METHOD;S256it will generate a random string, then get its SHA-256 digest, then base64 encode itplainit will generate a random stringSTATEas random stringCODE-VERIFIER, i.e. the random string, andSTATE; both are needed when the callback is handled in order to generate the token)https://[REDIRECT_URI]?code=RETURNED_CODE&state=STATE. Now there needs to be a callback handler that should:STATEand compare with the returnedSTATE; if not the same, fail the CSRF checkRETURNED_CODECODE-VERIFIERin the POST to the forgejo/login/oauth/access_tokenendpoint in order to exchange the code for a token. it needs:client_id: from configcode: the returned codegrant_type: "authorization_code" (from forgejo docs)redirect_uri: from configcode_verifier: grabbed from temporary storageNotes:
shacl-vuewill need to support updated configuration to allow configuring a complete OIDC workflowshacl-vuewill need additional functionality to allow multiple token entry, one of which could be via the OIDC workflow, and the option to select the "currently active" token to be used in ongoing submissions and data fetchingshacl-vuehas a large startup cost (loading config, schemas, data), and we don't want the redirect url to retrigger that -> the app state should be unaffected by the OIDC workflow. We could introduce app routing (which is currently used very minimally in the app), and create a specific Vue component that renders when the/oidc-callbackpath is accessed, and the app should then be updated to know that startup steps should be ignored when accessing that specific path/route. But if the navigation to the OIDC server is initially done in the same browser tab, we would also lose app state. This is why I think using the new tab/popup option is better.window.opener.postMessagewindow.close, this will show the original app page again, now with the token available.