anuoua 1ac0032e5c
feat: oidc (#1126)
* 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>
2022-11-29 23:18:21 +08:00

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();
};