Skip to content

Add openLogoutUri to add a custom redirect function on logout #353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions projects/lib/src/auth.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,12 @@ export class AuthConfig {
public openUri?: ((uri: string) => void) = uri => {
location.href = uri;
}
/**
* This property allows you to override the method that is used to open the logout url,
* allowing a way for implementations to specify their own method of routing to new
* urls.
*/
public openLogoutUri?: ((uri: string) => void) = uri => {
location.href = uri;
}
}
14 changes: 7 additions & 7 deletions projects/lib/src/oauth-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,14 @@ export class OAuthService extends AuthConfig {

/**
* DEPRECATED. Use a provider for OAuthStorage instead:
*
*
* { provide: OAuthStorage, useValue: localStorage }
*
*
* Sets a custom storage used to store the received
* tokens on client side. By default, the browser's
* sessionStorage is used.
* @ignore
*
*
* @param storage
*/
public setStorage(storage: OAuthStorage): void {
Expand Down Expand Up @@ -845,7 +845,7 @@ export class OAuthService extends AuthConfig {
const redirectUri = this.silentRefreshRedirectUri || this.redirectUri;
this.createLoginUrl(null, null, redirectUri, noPrompt, params).then(url => {
iframe.setAttribute('src', url);

if (!this.silentRefreshShowIFrame) {
iframe.style['display'] = 'none';
}
Expand Down Expand Up @@ -1738,9 +1738,9 @@ export class OAuthService extends AuthConfig {
logoutUrl =
this.logoutUrl +
(this.logoutUrl.indexOf('?') > -1 ? '&' : '?') +
params.toString()
}
location.href = logoutUrl;
params.toString();
}
this.config.openLogoutUri(logoutUrl);
}

/**
Expand Down