我有一个重定向后登录身份服务器的问题。
我有以下angular auth-oidc客户端配置:
export function configureAuth(oidcConfigService: OidcConfigService) {
return () =>
oidcConfigService.withConfig({
stsServer: 'http://localhost:5002',
redirectUrl: window.location.origin,
postLogoutRedirectUri: window.location.origin,
clientId: 'applications-portal',
scope: 'openid profile',
responseType: 'id_token token',
logLevel: LogLevel.Debug,
});
}
和应用程序。组成部分ts:
ngOnInit() {
this.oidcSecurityService.checkAuth().subscribe((auth) => {
console.log('is authenticated', auth);
if (!auth) {
this.login();
}
});
}
login() {
this.oidcSecurityService.authorize();
}
这是identity server应用程序中的客户端配置:
new Client
{
ClientId = "applications-portal",
ClientName = "Applications Portal",
AllowedGrantTypes = GrantTypes.Implicit,
AllowedScopes =
{
"service",
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile
},
AccessTokenType = AccessTokenType.Jwt,
AllowAccessTokensViaBrowser = true,
RequireConsent = false,
RequireClientSecret = false,
RequirePkce = true,
RedirectUris = {
"http://localhost:4200",
},
PostLogoutRedirectUris =
{
"http://localhost:4200"
},
AllowedCorsOrigins =
{
"http://localhost:4200"
},
}
和启动。反恐精英:
services.ConfigureApplicationCookie(config =>
{
config.Cookie.Name = "Identity.Cookie";
config.LoginPath = "/Auth/Login";
});
问题是,当我在Login(get)方法中被重定向到AuthController时,我得到的returnUrl如下所示:returnUrl值
登录后,它不会将我重定向回客户端应用程序,而是保留在登录页面上。我相信返回URL本身有问题。我第一次使用IdtyServer,所以我真的不知道该挖掘什么。
更新日期:
问题出在Chrome浏览器中。SameSite的东西阻止了它的重定向。我在这里尝试了解决方案https://www.thinktecture.com/en/identity/samesite/prepare-your-identityserver/但它不起作用。在其他浏览器中,它按预期工作。你能给我一个提示,在这种情况下Chrome怎么办?
我也试着将其设置为Lax,但没有任何变化。
services.ConfigureApplicationCookie(config =>
{
config.Cookie.Name = "Identity.Cookie";
config.LoginPath = "/Auth/Login";
config.Cookie.SameSite = Microsoft.AspNetCore.Http.SameSiteMode.Lax;
});
通过将Cookie配置更改为:
services.ConfigureApplicationCookie(config =>
{
config.Cookie.Name = "Identity.Cookie";
config.LoginPath = "/Auth/Login";
config.Cookie.SameSite = Microsoft.AspNetCore.Http.SameSiteMode.Lax;
});
在配置方法中:
app.UseCookiePolicy(new CookiePolicyOptions
{
MinimumSameSitePolicy = Microsoft.AspNetCore.Http.SameSiteMode.Lax,
});
一个想法是重定向URL是否应该是:
RedirectUris = {"http://localhost:4200/auth-callback"}.
该链接应该指向Angular希望将令牌发送到的URL。
请参阅以下链接:
问题内容: 我正在做一个简单的论坛,由一系列论坛组成,每个论坛分别代表首页,主题,postitit,登录名和用户列表页面。在某些页面上,当用户未登录时会出现一个链接。 我想要实现的是在登录后触发重定向(在RequestDispatcher上使用forward()),以便浏览器返回到用户在单击登录链接之前所在的页面。为此,我看到了两种解决方案。 第一种解决方案是使用带有登录按钮的HTML 和一个不可
我在Laravel5.2中使用了php artisan函数。 我想重定向的客人登录页面,若客人点击链接,只有用户并没有客人。 我想在登录后将用户重定向到后面的页面。 我怎么能这么做?请详细展示一些文件名示例。 ///////编辑 路线 控制器 Kernel.php
记录器文件中的日志- org.springframework.Security.Access.event.loggerlistener-安全授权失败,原因是:org.springframework.Security.Access.accessdeniedexception:访问被拒绝;通过身份验证的主体:org.springframework.security.authentication.ano
Reducer.js 我想在成功登录后重定向/主页。我如何重定向?
我有一个页面,上面有一些内容和评论部分。评论只能由已登录的用户留下,因此我在页面中添加了一个登录表单供用户登录(仅当用户尚未登录时显示)。 我的问题是,当用户登录时,他们会被重定向回主页,而不是他们以前所在的页面。 我没有更改开箱即用设置的登录方法。 任何人都可以建议一个简单的方法来设置重定向url。我的想法是,能够将其设置为表单会很好。
我使用设计与Rails为我的用户登录。这一切都很好,但是,我无法得到一个特定的重定向工作。 我是rails新手,所以我做事的方法可能不正确。 本质上,通过一个例子,我允许用户喜欢一个帖子。然而,他们需要登录才能这样做。我在我的控制器中创建了一个名为“喜欢”的动作,控制器具有设计过滤器 此时将显示登录页面。一旦用户登录,我想将他们重定向回他们喜欢的帖子,并调用“like”操作。 我的控制器看起来像