Re-authorize persistent login (MVC client) without triggering login UI

前端 未结 2 760
有刺的猬
有刺的猬 2021-01-20 05:42

I am trying to figure out how a server-side client (MVC / ASP.NET Core 2) can query IdentityServer4 to retrieve various claims scopes for a persistent login created in some

2条回答
  •  星月不相逢
    2021-01-20 05:54

    why not just make the authentication cookie permanent? Here's an other way to do it ... You can then check authentication on the server against the authentication server.

    on the client AddOpenIdConnect :

                    options.Events = new OpenIdConnectEvents {
                        OnRedirectToIdentityProvider = context => {
                            context.Properties.RedirectUri = context.Request.Path;
                            return Task.FromResult(0);
                        },
                        OnTicketReceived = context =>
                        {
                            context.Properties.IsPersistent = true;
                            context.Properties.ExpiresUtc = DateTimeOffset.UtcNow.AddDays(15);
                            context.Properties.AllowRefresh = true;
    
                            return Task.FromResult(0);
                        }
                    };
    

提交回复
热议问题