mirror of
https://github.com/outline/outline.git
synced 2026-11-22 14:01:41 +03:00
fix: Keep OIDC provider identifier in sync with configured domain (#13574)
This commit is contained in:
1 parent
d2697d354e
commit
46cfa0c8d0
1 file changed
+17
-1
@@ -164,9 +164,25 @@ export function createOIDCRouter(
|
||||
|
||||
// Derive a providerId from the OIDC location if there is no existing provider.
|
||||
const oidcURL = new URL(endpoints.authorizationURL);
|
||||
const providerId =
|
||||
let providerId =
|
||||
authenticationProvider?.providerId ?? oidcURL.hostname;
|
||||
|
||||
// The provider can move to a different domain, in which case the
|
||||
// stored identifier must follow the configured location.
|
||||
if (authenticationProvider && providerId !== oidcURL.hostname) {
|
||||
try {
|
||||
await authenticationProvider.update({
|
||||
providerId: oidcURL.hostname,
|
||||
});
|
||||
providerId = oidcURL.hostname;
|
||||
} catch (error) {
|
||||
Logger.warn(
|
||||
"Could not update OIDC authentication provider identifier",
|
||||
{ providerId, hostname: oidcURL.hostname, error }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!domain) {
|
||||
throw OIDCMalformedUserInfoError();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user