Identity Server: Redirect after login and logout in Angular?(身份服务器:在ANGLE中登录和注销后重定向?)
问题描述
我在一个基于.NET Core的角度项目中使用了IdentityServer,并通过修改使用了Identity Server razor登录页面。除了这个登录页面,我使用角度页面,并使用角度中的延迟加载功能重定向相关页面。
但是,我需要一些不同的登录和注销场景,如下所述:
1.用户登录后,我希望重定向特定页面。我如何设置此页面?在标识服务器操作方法中,还是在登录按钮的onClick操作中?我也可以通过hperlink使用HREF?
2.我是否应该使用ActionLink等,因为登录页面是通过将页面重定向到控制器,然后打开一个角度页面来实现的?还是使用登录按钮的href或routerlink属性并轻松调用相关的角度路线更好?
3.对于注销,我希望重定向一个有角度的页面。我应该在标识服务器配置的注销或注销回调属性中设置它吗?
如有任何帮助,我们将不胜感激。
更新:以下是可用于重定向或回调设置的常量文件:
export const LogoutActions = {
LogoutCallback: 'logout-callback',
Logout: 'logout',
LoggedOut: 'logged-out'
};
export const LoginActions = {
Login: 'login',
LoginCallback: 'login-callback',
LoginFailed: 'login-failed',
Profile: 'profile',
Register: 'register'
};
let applicationPaths: ApplicationPathsType = {
DefaultLoginRedirectPath: '/',
ApiAuthorizationClientConfigurationUrl: `/_configuration/${ApplicationName}`,
Login: `authentication/${LoginActions.Login}`,
LoginFailed: `authentication/${LoginActions.LoginFailed}`,
LoginCallback: `authentication/${LoginActions.LoginCallback}`,
Register: `authentication/${LoginActions.Register}`,
Profile: `authentication/${LoginActions.Profile}`,
LogOut: `authentication/${LogoutActions.Logout}`,
LoggedOut: `authentication/${LogoutActions.LoggedOut}`,
LogOutCallback: `authentication/${LogoutActions.LogoutCallback}`,
LoginPathComponents: [],
LoginFailedPathComponents: [],
LoginCallbackPathComponents: [],
RegisterPathComponents: [],
ProfilePathComponents: [],
LogOutPathComponents: [],
LoggedOutPathComponents: [],
LogOutCallbackPathComponents: [],
IdentityRegisterPath: '/Identity/Account/Register',
IdentityManagePath: '/Identity/Account/Manage'
};
applicationPaths = {
...applicationPaths,
LoginPathComponents: applicationPaths.Login.split('/'),
LoginFailedPathComponents: applicationPaths.LoginFailed.split('/'),
RegisterPathComponents: applicationPaths.Register.split('/'),
ProfilePathComponents: applicationPaths.Profile.split('/'),
LogOutPathComponents: applicationPaths.LogOut.split('/'),
LoggedOutPathComponents: applicationPaths.LoggedOut.split('/'),
LogOutCallbackPathComponents: applicationPaths.LogOutCallback.split('/')
};
身份
您要做的是将您的推荐答案客户端配置设置为通过<[2-1]和PostLogoutRedirectUris指向这些不同的组件。然后在ANGLE应用程序中,当您配置UserManager实例时,将redirect_uri和post_logout_redirect_uri设置为您希望Identity Server在登录/注销方法完成后重定向到的位置。这些配置需要在客户端和服务器之间匹配,否则身份服务器将拒绝该请求。布罗克·艾伦的一个样例应用程序Angular oidc-client.js揭示了这一点。
return Redirect("someurl oangularcomponent");将用户重定向到该组件。
这篇关于身份服务器:在ANGLE中登录和注销后重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:身份服务器:在ANGLE中登录和注销后重定向?
- 失败的 Canvas 360 jquery 插件 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
