- Silently fallback to local login if OIDC config is incorrect
This commit is contained in:
committed by
Aditya Chandel
parent
817b572c08
commit
fa32e33ea5
@@ -21,9 +21,9 @@ export function initializeAuthFactory() {
|
|||||||
scope: 'openid profile email offline_access',
|
scope: 'openid profile email offline_access',
|
||||||
redirectUri: window.location.origin + '/oauth2-callback',
|
redirectUri: window.location.origin + '/oauth2-callback',
|
||||||
responseType: 'code',
|
responseType: 'code',
|
||||||
showDebugInformation: true,
|
showDebugInformation: false,
|
||||||
requireHttps: false,
|
requireHttps: true,
|
||||||
strictDiscoveryDocumentValidation: false,
|
strictDiscoveryDocumentValidation: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
oauthService.events
|
oauthService.events
|
||||||
@@ -36,10 +36,19 @@ export function initializeAuthFactory() {
|
|||||||
authService.saveOidcTokens(accessToken, refreshToken ?? '');
|
authService.saveOidcTokens(accessToken, refreshToken ?? '');
|
||||||
});
|
});
|
||||||
|
|
||||||
oauthService.loadDiscoveryDocumentAndTryLogin().then(() => {
|
oauthService.loadDiscoveryDocumentAndTryLogin()
|
||||||
|
.then(() => {
|
||||||
oauthService.setupAutomaticSilentRefresh();
|
oauthService.setupAutomaticSilentRefresh();
|
||||||
websocketInitializer(authService);
|
websocketInitializer(authService);
|
||||||
resolve();
|
resolve();
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error(
|
||||||
|
'OIDC initialization failed: Unable to complete OpenID Connect discovery or login. ' +
|
||||||
|
'This may be due to an incorrect issuer URL, client ID, or network issue. ' +
|
||||||
|
'Falling back to local login. Details:', err
|
||||||
|
);
|
||||||
|
resolve();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
resolve();
|
resolve();
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
pInputText
|
pInputText
|
||||||
id="issuerUri"
|
id="issuerUri"
|
||||||
[(ngModel)]="oidcProvider.issuerUri"
|
[(ngModel)]="oidcProvider.issuerUri"
|
||||||
placeholder="e.g. https://auth.example.com/realms/myrealm"
|
placeholder="e.g. https://authentik.your-domain.com/application/o/booklore/"
|
||||||
class="w-full"/>
|
class="w-full"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="md:col-span-2">
|
<div class="md:col-span-2">
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
pInputText
|
pInputText
|
||||||
id="jwksUrl"
|
id="jwksUrl"
|
||||||
[(ngModel)]="oidcProvider.jwksUrl"
|
[(ngModel)]="oidcProvider.jwksUrl"
|
||||||
placeholder="e.g. https://auth.example.com/realms/myrealm/protocol/openid-connect/certs"
|
placeholder="e.g. https://authentik.your-domain.com/application/o/booklore/jwks/"
|
||||||
class="w-full"/>
|
class="w-full"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="md:col-span-2">
|
<div class="md:col-span-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user