diff --git a/client/packages/lowcoder/src/pages/setting/idSource/OAuthForms/GenericOAuthForm.tsx b/client/packages/lowcoder/src/pages/setting/idSource/OAuthForms/GenericOAuthForm.tsx
index 2513a7d06..7639636dd 100644
--- a/client/packages/lowcoder/src/pages/setting/idSource/OAuthForms/GenericOAuthForm.tsx
+++ b/client/packages/lowcoder/src/pages/setting/idSource/OAuthForms/GenericOAuthForm.tsx
@@ -17,8 +17,9 @@ import Flex from "antd/es/flex";
import Button from "antd/es/button";
import axios from "axios";
import { IconPicker } from "@lowcoder-ee/comps/controls/iconControl";
+import Switch from "antd/es/switch";
-const sourceMappingKeys = [
+export const sourceMappingKeys = [
'uid',
'email',
'username',
@@ -49,7 +50,7 @@ interface OpenIdProvider {
scopes_supported: string[],
}
-interface ConfigProvider {
+export interface ConfigProvider {
authType: string,
source: string,
sourceName: string,
@@ -223,6 +224,7 @@ function GenericOAuthForm(props: GenericOAuthFormProp) {
const isPassword = valueObject && valueObject.isPassword;
const isIcon = valueObject && valueObject.isIcon;
const isList = valueObject && valueObject.isList;
+ const isSwitch = valueObject && valueObject.isSwitch;
return (
- ) : !isPassword && !isList && isIcon ? (
+ ) : isSwitch ? (
+
+ ) : isIcon ? (
form1.setFieldValue("sourceIcon", value)}
label={'Source Icon'}
value={form1.getFieldValue('sourceIcon')}
/>
- ) : !isPassword && isList && !isIcon ? (
+ ) : isList ? (
{
if (!configDetail) {
goList();
}
- const handleSuccess = (values: ConfigItem) => {
+ const handleSuccess = (values: any) => {
setSaveLoading(true);
- const params = {
- ...values,
- ...(configDetail.ifLocal ? null : { id: configDetail.id }),
+ let params = {
+ id: configDetail.id,
authType: configDetail.authType,
+ enableRegister: configDetail.enableRegister,
};
+
+ if (configDetail.authType === AuthType.Generic) {
+ const { uid, email, avatar, username, ...newValues } = values;
+ params = {
+ ...newValues,
+ sourceMappings: {
+ uid,
+ email,
+ avatar,
+ username,
+ },
+ ...params,
+ }
+ } else {
+ params = {
+ ...values,
+ ...params,
+ }
+ }
IdSourceApi.saveConfig(params)
.then((resp) => {
if (validateResponse(resp)) {
@@ -157,7 +180,8 @@ export const IdSourceDetail = (props: IdSourceDetailProps) => {
>
{Object.entries(authConfig[configDetail.authType].form).map(([key, value]) => {
const valueObject = _.isObject(value) ? (value as ItemType) : false;
- let required = configDetail.ifLocal || (key !== "clientSecret" && key !== "publicKey");
+ // let required = configDetail.ifLocal || (key !== "clientSecret" && key !== "publicKey");
+ let required = (key === "clientId" || key === "clientSecret" || key === "scope");
required = valueObject ? valueObject.isRequire ?? required : required;
const hasLock = valueObject && valueObject?.hasLock;
const tip = valueObject && valueObject.tip;
@@ -165,6 +189,7 @@ export const IdSourceDetail = (props: IdSourceDetailProps) => {
const isList = valueObject && valueObject.isList;
const isPassword = valueObject && valueObject.isPassword;
const isIcon = valueObject && valueObject.isIcon;
+ const isSwitch = valueObject && valueObject.isSwitch;
return (
{
}
autoComplete={"one-time-code"}
/>
- ) : !isPassword && !isList && !isIcon ? (
- handleLockClick()} /> : )
- }
- />
- ) : !isPassword && !isList && isIcon ? (
+ ) : isSwitch ? (
+
+ ) : isIcon ? (
form.setFieldValue("sourceIcon", value)}
label={'Source Icon'}
value={form.getFieldValue('sourceIcon')}
/>
- ) : (
+ ) : isList ? (
+ ) : (
+ handleLockClick()} /> : )
+ }
+ />
)}
{hasLock && lock && (
@@ -246,6 +273,34 @@ export const IdSourceDetail = (props: IdSourceDetailProps) => {
{trans("idSource.enableRegister")}
*/}
+ {configDetail.authType === AuthType.Generic && (
+ <>
+ Source Mappings
+ {sourceMappingKeys.map(sourceKey => (
+
+
+ →
+
+
+
+
+ ))}
+ >
+ )}
+
{configDetail.enable ? trans("idSource.save") : trans("idSource.saveBtn")}
diff --git a/client/packages/lowcoder/src/pages/setting/idSource/idSourceConstants.ts b/client/packages/lowcoder/src/pages/setting/idSource/idSourceConstants.ts
index d15cc3656..a966b5228 100644
--- a/client/packages/lowcoder/src/pages/setting/idSource/idSourceConstants.ts
+++ b/client/packages/lowcoder/src/pages/setting/idSource/idSourceConstants.ts
@@ -100,6 +100,7 @@ export const authConfig = {
userInfoEndpoint: { label: 'UserInfo Endpoint', isRequire: true },
// jwks: { label: 'Authorize URL', isRequire: true },
scope: "Scope",
+ userInfoIntrospection: { label: 'Use OpenID User Introspection', isSwitch: true, isRequire: false},
// baseUrl: "Base URL",
// realm: "Realm",
},
@@ -126,6 +127,7 @@ export type ItemType = {
isRequire?: boolean;
isPassword?: boolean;
isIcon?: boolean;
+ isSwitch?: boolean;
hasLock?: boolean;
tip?: string;
}