mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 08:19:07 +00:00
Merge pull request #19741 from strapi/feat/keycloak-grant
feat: Add keycloak native users-permissions provider
This commit is contained in:
commit
3cc05002fb
@ -128,4 +128,13 @@ module.exports = (baseURL) => ({
|
||||
callback: `${baseURL}/patreon/callback`,
|
||||
scope: ['identity', 'identity[email]'],
|
||||
},
|
||||
keycloak: {
|
||||
enabled: false,
|
||||
icon: '',
|
||||
key: '',
|
||||
secret: '',
|
||||
subdomain: 'myKeycloakProvider.com/realms/myrealm',
|
||||
callback: `${baseURL}/keycloak/callback`,
|
||||
scope: ['openid', 'email', 'profile'],
|
||||
},
|
||||
});
|
||||
|
@ -331,6 +331,21 @@ const getInitialProviders = ({ purest }) => ({
|
||||
};
|
||||
});
|
||||
},
|
||||
async keycloak({ accessToken, providers }) {
|
||||
const keycloak = purest({ provider: 'keycloak' });
|
||||
|
||||
return keycloak
|
||||
.subdomain(providers.keycloak.subdomain)
|
||||
.get('protocol/openid-connect/userinfo')
|
||||
.auth(accessToken)
|
||||
.request()
|
||||
.then(({ body }) => {
|
||||
return {
|
||||
username: body.preferred_username,
|
||||
email: body.email,
|
||||
};
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user