mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 13:19:44 +02:00
feat: Add ability to map OIDC attributes and ignore username
Some checks failed
Build and push Docker DEV image / build ([self-hosted arm64], linux/arm/v7) (push) Has been cancelled
Build and push Docker DEV image / build ([self-hosted arm64], linux/arm64) (push) Has been cancelled
Build and push Docker DEV image / build ([self-hosted x64], linux/amd64) (push) Has been cancelled
Build and push Docker DEV image / merge (push) Has been cancelled
Build and push Docker DEV image / rerun-failed-jobs (push) Has been cancelled
Some checks failed
Build and push Docker DEV image / build ([self-hosted arm64], linux/arm/v7) (push) Has been cancelled
Build and push Docker DEV image / build ([self-hosted arm64], linux/arm64) (push) Has been cancelled
Build and push Docker DEV image / build ([self-hosted x64], linux/amd64) (push) Has been cancelled
Build and push Docker DEV image / merge (push) Has been cancelled
Build and push Docker DEV image / rerun-failed-jobs (push) Has been cancelled
Closes #554
This commit is contained in:
parent
31d4d5f38d
commit
634d6ceab1
13 changed files with 112 additions and 72 deletions
|
@ -38,7 +38,10 @@ module.exports = {
|
|||
throw 'invalidCodeOrNonce';
|
||||
}
|
||||
|
||||
if (!userInfo.email || !userInfo.name) {
|
||||
if (
|
||||
!userInfo[sails.config.custom.oidcEmailAttribute] ||
|
||||
!userInfo[sails.config.custom.oidcNameAttribute]
|
||||
) {
|
||||
throw 'missingValues';
|
||||
}
|
||||
|
||||
|
@ -56,12 +59,14 @@ module.exports = {
|
|||
|
||||
const values = {
|
||||
isAdmin,
|
||||
email: userInfo.email,
|
||||
email: userInfo[sails.config.custom.oidcEmailAttribute],
|
||||
isSso: true,
|
||||
name: userInfo.name,
|
||||
username: userInfo.preferred_username,
|
||||
name: userInfo[sails.config.custom.oidcNameAttribute],
|
||||
subscribeToOwnCards: false,
|
||||
};
|
||||
if (!sails.config.custom.oidcIgnoreUsername) {
|
||||
values.username = userInfo[sails.config.custom.oidcUsernameAttribute];
|
||||
}
|
||||
|
||||
let user;
|
||||
// This whole block technically needs to be executed in a transaction
|
||||
|
@ -95,7 +100,10 @@ module.exports = {
|
|||
});
|
||||
}
|
||||
|
||||
const updateFieldKeys = ['email', 'isSso', 'name', 'username'];
|
||||
const updateFieldKeys = ['email', 'isSso', 'name'];
|
||||
if (!sails.config.custom.oidcIgnoreUsername) {
|
||||
updateFieldKeys.push('username');
|
||||
}
|
||||
if (!sails.config.custom.oidcIgnoreRoles) {
|
||||
updateFieldKeys.push('isAdmin');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue