mirror of
https://github.com/plankanban/planka.git
synced 2025-07-24 15:49:46 +02:00
feat: Improve OIDC support for strict providers (#824)
This commit is contained in:
parent
8d74cc1732
commit
ad2966c5d6
5 changed files with 34 additions and 6 deletions
|
@ -13,6 +13,9 @@ const Errors = {
|
|||
MISSING_VALUES: {
|
||||
missingValues: 'Unable to retrieve required values (email, name)',
|
||||
},
|
||||
INVALID_USERINFO_SIGNATURE: {
|
||||
invalidUserInfoSignature: "Invalid signature on userInfo due to client misconfiguration"
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -40,6 +43,9 @@ module.exports = {
|
|||
missingValues: {
|
||||
responseType: 'unprocessableEntity',
|
||||
},
|
||||
invalidUserInfoSignature: {
|
||||
responseType: 'unauthorized',
|
||||
},
|
||||
},
|
||||
|
||||
async fn(inputs) {
|
||||
|
@ -51,6 +57,7 @@ module.exports = {
|
|||
sails.log.warn(`Invalid code or nonce! (IP: ${remoteAddress})`);
|
||||
return Errors.INVALID_CODE_OR_NONCE;
|
||||
})
|
||||
.intercept('invalidUserInfoSignature', () => Errors.INVALID_USERINFO_SIGNATURE)
|
||||
.intercept('emailAlreadyInUse', () => Errors.EMAIL_ALREADY_IN_USE)
|
||||
.intercept('usernameAlreadyInUse', () => Errors.USERNAME_ALREADY_IN_USE)
|
||||
.intercept('missingValues', () => Errors.MISSING_VALUES);
|
||||
|
|
|
@ -4,11 +4,16 @@ module.exports = {
|
|||
if (sails.hooks.oidc.isActive()) {
|
||||
const oidcClient = sails.hooks.oidc.getClient();
|
||||
|
||||
const authorizationParameters = {
|
||||
scope: sails.config.custom.oidcScopes,
|
||||
}
|
||||
|
||||
if(!sails.config.custom.oidcDefaultResponseMode) {
|
||||
authorizationParameters.response_mode = sails.config.custom.oidcResponseMode
|
||||
}
|
||||
|
||||
oidc = {
|
||||
authorizationUrl: oidcClient.authorizationUrl({
|
||||
scope: sails.config.custom.oidcScopes,
|
||||
response_mode: 'fragment',
|
||||
}),
|
||||
authorizationUrl: oidcClient.authorizationUrl(authorizationParameters),
|
||||
endSessionUrl: oidcClient.issuer.end_session_endpoint ? oidcClient.endSessionUrl({}) : null,
|
||||
isEnforced: sails.config.custom.oidcEnforced,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue