mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-14 16:05:18 +00:00
feat(sso): enhance OIDC registration mapping for Azure and other providers
- Updated the mapping logic in `register-oidc-dialog` to differentiate between Azure and other identity providers. - Simplified the mapping structure for user attributes based on the issuer, improving flexibility in handling various OIDC providers.
This commit is contained in:
@@ -101,6 +101,22 @@ export function RegisterOidcDialog({ children }: RegisterOidcDialogProps) {
|
|||||||
const scopes = data.scopes.filter(Boolean).length
|
const scopes = data.scopes.filter(Boolean).length
|
||||||
? data.scopes.filter(Boolean)
|
? data.scopes.filter(Boolean)
|
||||||
: DEFAULT_SCOPES;
|
: DEFAULT_SCOPES;
|
||||||
|
|
||||||
|
const isAzure = data.issuer.includes("login.microsoftonline.com");
|
||||||
|
const mapping = isAzure
|
||||||
|
? {
|
||||||
|
id: "sub",
|
||||||
|
email: "preferred_username",
|
||||||
|
emailVerified: "email_verified",
|
||||||
|
name: "name",
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
id: "sub",
|
||||||
|
email: "email",
|
||||||
|
emailVerified: "email_verified",
|
||||||
|
name: "preferred_username",
|
||||||
|
image: "picture",
|
||||||
|
};
|
||||||
await mutateAsync({
|
await mutateAsync({
|
||||||
providerId: data.providerId,
|
providerId: data.providerId,
|
||||||
issuer: data.issuer,
|
issuer: data.issuer,
|
||||||
@@ -110,14 +126,7 @@ export function RegisterOidcDialog({ children }: RegisterOidcDialogProps) {
|
|||||||
clientSecret: data.clientSecret,
|
clientSecret: data.clientSecret,
|
||||||
scopes,
|
scopes,
|
||||||
pkce: true,
|
pkce: true,
|
||||||
// Keycloak (and many IdPs) send preferred_username; better-auth expects name
|
mapping,
|
||||||
mapping: {
|
|
||||||
id: "sub",
|
|
||||||
email: "email",
|
|
||||||
emailVerified: "email_verified",
|
|
||||||
name: "preferred_username",
|
|
||||||
image: "picture",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -109,12 +109,12 @@ export const SSOSettings = () => {
|
|||||||
Add OIDC provider
|
Add OIDC provider
|
||||||
</Button>
|
</Button>
|
||||||
</RegisterOidcDialog>
|
</RegisterOidcDialog>
|
||||||
<RegisterSamlDialog>
|
{/* <RegisterSamlDialog>
|
||||||
<Button variant="secondary" size="sm">
|
<Button variant="secondary" size="sm">
|
||||||
<LogIn className="mr-2 size-4" />
|
<LogIn className="mr-2 size-4" />
|
||||||
Add SAML provider
|
Add SAML provider
|
||||||
</Button>
|
</Button>
|
||||||
</RegisterSamlDialog>
|
</RegisterSamlDialog> */}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -234,12 +234,12 @@ export const SSOSettings = () => {
|
|||||||
Add OIDC provider
|
Add OIDC provider
|
||||||
</Button>
|
</Button>
|
||||||
</RegisterOidcDialog>
|
</RegisterOidcDialog>
|
||||||
<RegisterSamlDialog>
|
{/* <RegisterSamlDialog>
|
||||||
<Button variant="outline">
|
<Button variant="outline">
|
||||||
<LogIn className="mr-2 size-4" />
|
<LogIn className="mr-2 size-4" />
|
||||||
Add SAML provider
|
Add SAML provider
|
||||||
</Button>
|
</Button>
|
||||||
</RegisterSamlDialog>
|
</RegisterSamlDialog> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user