Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
response_type: 'id_token token',
scope: 'openid email roles',
silent_redirect_uri: 'http://localhost:4200/silent-renew.html',
automaticSilentRenew: true,
accessTokenExpiringNotificationTime: 4,
// silentRequestTimeout:10000,
filterProtocolClaims: true,
loadUserInfo: true
};
@Injectable()
export class AuthService {
mgr: UserManager = new UserManager(settings);
userLoadededEvent: EventEmitter = new EventEmitter();
currentUser: User;
loggedIn = false;
authHeaders: Headers;
constructor(private http: Http) {
this.mgr.getUser()
.then((user) => {
if (user) {
this.loggedIn = true;
this.currentUser = user;
this.userLoadededEvent.emit(user);
}
constructor() {
const settings = {
authority: Constants.stsAuthority,
client_id: Constants.clientId,
redirect_uri: `${Constants.clientRoot}signin-callback.html`,
silent_redirect_uri: `${Constants.clientRoot}silent-renew.html`,
// tslint:disable-next-line:object-literal-sort-keys
post_logout_redirect_uri: `${Constants.clientRoot}`,
response_type: 'code',
scope: Constants.clientScope
};
this.userManager = new UserManager(settings);
Log.logger = console;
Log.level = Log.INFO;
}
constructor() {
const settings = {
authority: `${process.env.REACT_APP_IDENTITY_SERVER_URI}`,
client_id: `${process.env.REACT_APP_CLIENT_ID}`,
redirect_uri: `${process.env.REACT_APP_URI}/authentication/callback`,
silent_redirect_uri: `${process.env.REACT_APP_URI}/authentication/silentCallback`,
post_logout_redirect_uri: `${process.env.REACT_APP_URI}/`,
response_type: 'id_token token',
scope: 'openid profile ReactAdvantageApi'
};
this.userManager = new UserManager(settings);
Log.logger = console;
Log.level = Log.INFO;
}
constructor(
openidConfigurationUrl: string,
clientId: string,
baseRedirectUrl: string,
providerName: string
) {
this.userManager = new UserManager({
authority: openidConfigurationUrl,
client_id: clientId,
redirect_uri: urlUtils.getRedirectUrl(baseRedirectUrl),
silent_redirect_uri: urlUtils.getSilentRedirectUrl(baseRedirectUrl),
scope: "openid profile",
userStore: new WebStorageStateStore({ store: window.localStorage })
});
this.displayName = providerName;
}
constructor() {
var settings = {
authority: Constants.stsAuthority,
client_id: Constants.clientId,
redirect_uri: `${Constants.clientRoot}assets/signin-callback.html`,
silent_redirect_uri: `${Constants.clientRoot}assets/silent-callback.html`,
post_logout_redirect_uri: `${Constants.clientRoot}`,
response_type: 'id_token token',
scope: Constants.clientScope
};
this._userManager = new UserManager(settings);
}
data() {
return {
routes,
collapsed: true,
userManager: new UserManager(config),
isAuthenticated: false,
userName: ""
};
},
created() {
export const createOidcUserManager = (oidcSettings) => {
const oidcConfig = getOidcConfig(oidcSettings)
requiredConfigProperties.forEach((requiredProperty) => {
if (!oidcConfig[requiredProperty]) {
throw new Error('Required oidc setting ' + requiredProperty + ' missing for creating UserManager')
}
})
return new UserManager(oidcConfig)
}
private async createUserManager(requestContext: FrontendRequestContext): Promise {
const settings: UserManagerSettings = await this.getUserManagerSettings(requestContext);
this._userManager = new UserManager(settings);
this._userManager.events.addUserLoaded(this._onUserLoaded);
this._userManager.events.addUserUnloaded(this._onUserUnloaded);
this._userManager.events.addAccessTokenExpiring(this._onAccessTokenExpiring);
this._userManager.events.addAccessTokenExpired(this._onAccessTokenExpired);
this._userManager.events.addSilentRenewError(this._onSilentRenewError);
this._userManager.events.addUserSignedOut(this._onUserSignedOut);
return this._userManager;
}
export const authenticationService = config => {
if (userManager) {
return userManager;
}
userManager = new UserManager(config);
return userManager;
};
constructor() {
const settings = {
authority: `${process.env.REACT_APP_AUTHORITY}`,
client_id: 'backoffice',
redirect_uri: `${process.env.REACT_APP_ROOT_URL}/signin-callback.html`,
//silent_redirect_uri: `${process.env.REACT_APP_ROOT_URL}/silent-renew.html`,
post_logout_redirect_uri: `${process.env.REACT_APP_ROOT_URL}`,
response_type: 'id_token token',
scope: 'inventory_api_scope cart_api_scope catalog_api_scope rating_api_scope openid profile'
}
this.userManager = new UserManager(settings)
Log.logger = console
Log.level = Log.INFO
}