0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-02-10 21:58:23 -05:00

refactor(core): align role_names claim with DB (#1016)

This commit is contained in:
Gao Sun 2022-06-01 15:43:16 +08:00 committed by GitHub
parent 9f68a7a124
commit 8a52c84e32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -88,7 +88,7 @@ export default async function initOidc(app: Koa): Promise<Provider> {
ctx.request.origin === origin || isOriginAllowed(origin, client.metadata()), ctx.request.origin === origin || isOriginAllowed(origin, client.metadata()),
// https://github.com/panva/node-oidc-provider/blob/main/recipes/claim_configuration.md // https://github.com/panva/node-oidc-provider/blob/main/recipes/claim_configuration.md
claims: { claims: {
profile: ['username', 'name', 'avatar', 'roles'], profile: ['username', 'name', 'avatar', 'role_names', 'custom_data'],
}, },
// https://github.com/panva/node-oidc-provider/tree/main/docs#findaccount // https://github.com/panva/node-oidc-provider/tree/main/docs#findaccount
findAccount: async (_ctx, sub) => { findAccount: async (_ctx, sub) => {
@ -102,7 +102,7 @@ export default async function initOidc(app: Koa): Promise<Provider> {
username, username,
name, name,
avatar, avatar,
roles: roleNames, roleNames,
...(use === 'userinfo' && { customData }), ...(use === 'userinfo' && { customData }),
}); });
}, },