Skip to content

Commit c9620bf

Browse files
Merge branch 'janv8000-identityserver_encoding_state_fix' into 24-auth-code-with-pkce
2 parents 25fa6c1 + c457f2b commit c9620bf

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/app/core/auth-config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ export const authConfig: AuthConfig = {
1111
timeoutFactor: 0.25, // For faster testing
1212
sessionChecksEnabled: true,
1313
showDebugInformation: true, // Also requires enabling "Verbose" level in devtools
14-
clearHashAfterLogin: false, // https://github.com/manfredsteyer/angular-oauth2-oidc/issues/457#issuecomment-431807040
14+
clearHashAfterLogin: false, // https://github.com/manfredsteyer/angular-oauth2-oidc/issues/457#issuecomment-431807040,
15+
nonceStateSeparator : 'semicolon' // Real semicolon gets mangled by IdentityServer's URI encoding
1516
};

src/app/core/auth.service.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,12 @@ export class AuthService {
150150
// login(...) should never have this, but in case someone ever calls
151151
// initImplicitFlow(undefined | null) this could happen.
152152
if (this.oauthService.state && this.oauthService.state !== 'undefined' && this.oauthService.state !== 'null') {
153-
console.log('There was state, so we are sending you to: ' + this.oauthService.state);
154-
this.router.navigateByUrl(this.oauthService.state);
153+
let stateUrl = this.oauthService.state;
154+
if (stateUrl.startsWith('/') === false) {
155+
stateUrl = decodeURIComponent(stateUrl);
156+
}
157+
console.log(`There was state of ${this.oauthService.state}, so we are sending you to: ${stateUrl}`);
158+
this.router.navigateByUrl(stateUrl);
155159
}
156160
})
157161
.catch(() => this.isDoneLoadingSubject$.next(true));

0 commit comments

Comments
 (0)