oidc-client
Version:
OpenID Connect (OIDC) & OAuth2 client library
122 lines (108 loc) • 4.41 kB
JavaScript
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
import { Log } from './Log.js';
import { OidcClientSettings } from './OidcClientSettings.js';
import { RedirectNavigator } from './RedirectNavigator.js';
import { PopupNavigator } from './PopupNavigator.js';
import { IFrameNavigator } from './IFrameNavigator.js';
import { WebStorageStateStore } from './WebStorageStateStore.js';
import { Global } from './Global.js';
const DefaultAccessTokenExpiringNotificationTime = 60;
const DefaultCheckSessionInterval = 2000;
const DefaultQuerySessionStatusResponseType = "id_token";
export class UserManagerSettings extends OidcClientSettings {
constructor({
popup_redirect_uri,
popup_post_logout_redirect_uri,
popupWindowFeatures,
popupWindowTarget,
silent_redirect_uri,
silentRequestTimeout,
automaticSilentRenew = false,
includeIdTokenInSilentRenew = true,
monitorSession = true,
checkSessionInterval = DefaultCheckSessionInterval,
stopCheckSessionOnError = true,
query_status_response_type = DefaultQuerySessionStatusResponseType,
revokeAccessTokenOnSignout = false,
accessTokenExpiringNotificationTime = DefaultAccessTokenExpiringNotificationTime,
redirectNavigator = new RedirectNavigator(),
popupNavigator = new PopupNavigator(),
iframeNavigator = new IFrameNavigator(),
userStore = new WebStorageStateStore({ store: Global.sessionStorage })
} = {}) {
super(arguments[0]);
this._popup_redirect_uri = popup_redirect_uri;
this._popup_post_logout_redirect_uri = popup_post_logout_redirect_uri;
this._popupWindowFeatures = popupWindowFeatures;
this._popupWindowTarget = popupWindowTarget;
this._silent_redirect_uri = silent_redirect_uri;
this._silentRequestTimeout = silentRequestTimeout;
this._automaticSilentRenew = !!automaticSilentRenew;
this._includeIdTokenInSilentRenew = includeIdTokenInSilentRenew;
this._accessTokenExpiringNotificationTime = accessTokenExpiringNotificationTime;
this._monitorSession = monitorSession;
this._checkSessionInterval = checkSessionInterval;
this._stopCheckSessionOnError = stopCheckSessionOnError;
this._query_status_response_type = query_status_response_type;
this._revokeAccessTokenOnSignout = revokeAccessTokenOnSignout;
this._redirectNavigator = redirectNavigator;
this._popupNavigator = popupNavigator;
this._iframeNavigator = iframeNavigator;
this._userStore = userStore;
}
get popup_redirect_uri() {
return this._popup_redirect_uri;
}
get popup_post_logout_redirect_uri() {
return this._popup_post_logout_redirect_uri;
}
get popupWindowFeatures() {
return this._popupWindowFeatures;
}
get popupWindowTarget() {
return this._popupWindowTarget;
}
get silent_redirect_uri() {
return this._silent_redirect_uri;
}
get silentRequestTimeout() {
return this._silentRequestTimeout;
}
get automaticSilentRenew() {
return !!(this.silent_redirect_uri && this._automaticSilentRenew);
}
get includeIdTokenInSilentRenew() {
return this._includeIdTokenInSilentRenew;
}
get accessTokenExpiringNotificationTime() {
return this._accessTokenExpiringNotificationTime;
}
get monitorSession() {
return this._monitorSession;
}
get checkSessionInterval() {
return this._checkSessionInterval;
}
get stopCheckSessionOnError(){
return this._stopCheckSessionOnError;
}
get query_status_response_type(){
return this._query_status_response_type;
}
get revokeAccessTokenOnSignout() {
return this._revokeAccessTokenOnSignout;
}
get redirectNavigator() {
return this._redirectNavigator;
}
get popupNavigator() {
return this._popupNavigator;
}
get iframeNavigator() {
return this._iframeNavigator;
}
get userStore() {
return this._userStore;
}
}