本文整理汇总了TypeScript中oidc-client.UserManager.getUser方法的典型用法代码示例。如果您正苦于以下问题:TypeScript UserManager.getUser方法的具体用法?TypeScript UserManager.getUser怎么用?TypeScript UserManager.getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oidc-client.UserManager
的用法示例。
在下文中一共展示了UserManager.getUser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: setupUserManager
setupUserManager(stsAuthroity: string) {
const config: UserManagerSettings = {
authority: stsAuthroity,
client_id: 'spa-client',
redirect_uri: `${location.origin}/login-redirect.html`,
scope: 'openid spa-api profile offline_access',
response_type: 'id_token token',
post_logout_redirect_uri: `${location.origin}?postLogout=true`,
userStore: new WebStorageStateStore({ store: window.localStorage }),
automaticSilentRenew: true,
silent_redirect_uri: `${location.origin}/silent-renew.html`
};
this.userManager = new UserManager(config);
this.userManager.getUser().then(user => {
if (user && !user.expired) {
this.user = user;
// this.loadSecurityContext();
}
});
this.userManager.events.addUserLoaded(args => {
this.userManager.getUser().then(user => {
this.user = user;
// this.loadSecurityContext();
});
});
}
示例2:
this.userManager.events.addUserLoaded(args => {
this.userManager.getUser().then(user => {
this.user = user;
// this.loadSecurityContext();
});
});
示例3: getUser
/**
* 获取用户信息
*/
getUser() {
return this.manager.getUser();
}