mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 18:52:20 +08:00
* feat: oidc * feat: oidc remove comments * feat: oidc add shared type * feat: oidc add id_token sign alg * feat: oidc i18n & batch delete * feat: oidc i18n * feat: oidc import fix * feat: oidc saml list fix * feat: oidc i18n move to plugin * feat: oidc cr fix * feat: oidc cr fix * feat: oidc cr fix * feat: oidc fix nonce value * feat: oidc page extension fix * feat: oidc remove canceltoken Co-authored-by: chenos <chenlinxh@gmail.com>
25 lines
659 B
TypeScript
25 lines
659 B
TypeScript
import { Context } from '@nocobase/actions';
|
|
import { createOIDCClient } from '../shared/createOIDCClient';
|
|
import { OIDCProvider } from '../shared/types';
|
|
|
|
export const getAuthUrl = async (ctx: Context, next) => {
|
|
const {
|
|
params: { values },
|
|
} = ctx.action;
|
|
const providerRepo = ctx.db.getRepository('oidcProviders');
|
|
const record = await providerRepo.findOne({
|
|
filter: {
|
|
clientId: values.clientId,
|
|
},
|
|
});
|
|
const provider: OIDCProvider = record.toJSON();
|
|
const client = await createOIDCClient(provider);
|
|
|
|
ctx.body = client.authorizationUrl({
|
|
nonce: ctx.OIDC_NONCE,
|
|
scope: 'openid profile',
|
|
});
|
|
|
|
return next();
|
|
};
|