diff --git a/packages/plugins/oidc/src/client/OIDCButton.tsx b/packages/plugins/oidc/src/client/OIDCButton.tsx index 725c344cb..00759b6fc 100644 --- a/packages/plugins/oidc/src/client/OIDCButton.tsx +++ b/packages/plugins/oidc/src/client/OIDCButton.tsx @@ -53,9 +53,6 @@ export const OIDCButton = (props: { authenticator: Authenticator }) => { redirect(); } catch (err) { console.error(err); - } finally { - windowHandler.close(); - setWindowHandler(undefined); } }); @@ -65,9 +62,10 @@ export const OIDCButton = (props: { authenticator: Authenticator }) => { useEffect(() => { if (!windowHandler) return; - window.addEventListener('message', handleOIDCLogin); + const channel = new BroadcastChannel('nocobase-oidc-response'); + channel.onmessage = handleOIDCLogin; return () => { - window.removeEventListener('message', handleOIDCLogin); + channel.close(); }; }, [windowHandler, handleOIDCLogin]); diff --git a/packages/plugins/oidc/src/client/Options.tsx b/packages/plugins/oidc/src/client/Options.tsx index 3f97a70c6..6b2feb76a 100644 --- a/packages/plugins/oidc/src/client/Options.tsx +++ b/packages/plugins/oidc/src/client/Options.tsx @@ -39,11 +39,41 @@ const schema = { tooltip: '{{t("Default: openid profile email")}}', }, }, + idTokenSignedResponseAlg: { + title: '{{t("id_token signed response algorithm")}}', + 'x-component': 'Select', + 'x-decorator': 'FormItem', + enum: [ + { label: 'HS256', value: 'HS256' }, + { label: 'HS384', value: 'HS384' }, + { label: 'HS512', value: 'HS512' }, + { label: 'RS256', value: 'RS256' }, + { label: 'RS384', value: 'RS384' }, + { label: 'RS512', value: 'RS512' }, + { label: 'ES256', value: 'ES256' }, + { label: 'ES384', value: 'ES384' }, + { label: 'ES512', value: 'ES512' }, + { label: 'PS256', value: 'PS256' }, + { label: 'PS384', value: 'PS384' }, + { label: 'PS512', value: 'PS512' }, + ], + }, http: { - title: '{{t("http")}}', + title: '{{t("HTTP")}}', 'x-component': 'Checkbox', 'x-decorator': 'FormItem', }, + port: { + title: '{{t("Port")}}', + 'x-component': 'InputNumber', + 'x-decorator': 'FormItem', + 'x-component-props': { + style: { + width: '15%', + 'min-width': '100px', + }, + }, + }, fieldMap: { title: '{{t("Field Map")}}', type: 'array', diff --git a/packages/plugins/oidc/src/client/locale/zh-CN.ts b/packages/plugins/oidc/src/client/locale/zh-CN.ts index a2464288c..efa63d5de 100644 --- a/packages/plugins/oidc/src/client/locale/zh-CN.ts +++ b/packages/plugins/oidc/src/client/locale/zh-CN.ts @@ -5,4 +5,5 @@ export default { Edit: '编辑', Copied: '已复制', 'Field Map': '字段映射', + 'id_token signed response algorithm': 'id_token签名算法', }; diff --git a/packages/plugins/oidc/src/server/actions/redirect.ts b/packages/plugins/oidc/src/server/actions/redirect.ts index 5c2aa1858..3f962f18c 100644 --- a/packages/plugins/oidc/src/server/actions/redirect.ts +++ b/packages/plugins/oidc/src/server/actions/redirect.ts @@ -14,7 +14,9 @@ export const redirect = async (ctx: Context, next) => {