mirror of
https://github.com/wekan/wekan.git
synced 2025-12-18 00:10:13 +01:00
Update oidc_server.js
added hack for getting the claims in the accessToken instead of the /adfs/oauth2/userinfo endpoint https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/overview/ad-fs-faq#i-am-trying-to-get-additional-claims-on-the-user-info-endpoint-but-its-only-returning-subject-how-can-i-get-additional-claims Environment variable needed set OAUTH2_ADFS=true
This commit is contained in:
parent
9a4136399f
commit
a1f9536657
1 changed files with 14 additions and 1 deletions
|
|
@ -9,7 +9,20 @@ OAuth.registerService('oidc', 2, null, function (query) {
|
||||||
var accessToken = token.access_token || token.id_token;
|
var accessToken = token.access_token || token.id_token;
|
||||||
var expiresAt = (+new Date) + (1000 * parseInt(token.expires_in, 10));
|
var expiresAt = (+new Date) + (1000 * parseInt(token.expires_in, 10));
|
||||||
|
|
||||||
var userinfo = getUserInfo(accessToken);
|
var claimsInAccessToken = process.env.OAUTH2_ADFS || false;
|
||||||
|
|
||||||
|
var userinfo;
|
||||||
|
if(claimsInAccessToken)
|
||||||
|
{
|
||||||
|
// hack when using custom claims in the accessToken. On premise ADFS
|
||||||
|
userinfo = getTokenContent(accessToken);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// normal behaviour, getting the claims from UserInfo endpoint.
|
||||||
|
userinfo = getUserInfo(accessToken);
|
||||||
|
}
|
||||||
|
|
||||||
if (userinfo.ocs) userinfo = userinfo.ocs.data; // Nextcloud hack
|
if (userinfo.ocs) userinfo = userinfo.ocs.data; // Nextcloud hack
|
||||||
if (userinfo.metadata) userinfo = userinfo.metadata // Openshift hack
|
if (userinfo.metadata) userinfo = userinfo.metadata // Openshift hack
|
||||||
if (debug) console.log('XXX: userinfo:', userinfo);
|
if (debug) console.log('XXX: userinfo:', userinfo);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue