小编Yes*_*Yes的帖子

使用owin中间件和IdentityServer v3刷新令牌

我最近设置了IdentityServer v3并且它像梦一样运行,但是我遇到了OWIN中间件的麻烦.

我想使用混合流程,因此我可以在后端刷新令牌而无需用户重定向到IdentityServer每5分钟获取一个新的访问令牌(这也是奇怪的,因为它的设置为1小时的生命周期在服务器上).

我在启动时使用了以下配置,并且我的令牌很好,但是它似乎永远不会尝试在访问令牌过期后刷新它.我需要一些自定义逻辑来刷新我的令牌吗?

        app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
        {
            ClientId = clientId,
            ClientSecret = clientSecret, //Not sure what this does?

            Authority = "https://auth.example.com",

            RedirectUri = "http://website.example.com",
            PostLogoutRedirectUri = "http://website.example.com",

            ResponseType = "code id_token token",
            Scope = "openid profile email write read offline_access",

            SignInAsAuthenticationType = "Cookies",

            Notifications = new OpenIdConnectAuthenticationNotifications
            {
                AuthorizationCodeReceived = async n =>
                {
                    // filter "protocol" claims
                    var claims = new List<Claim>(from c in n.AuthenticationTicket.Identity.Claims
                                                 where c.Type != "iss" &&
                                                       c.Type != "aud" &&
                                                       c.Type != "nbf" &&
                                                       c.Type …
Run Code Online (Sandbox Code Playgroud)

c# oauth-2.0 openid-connect identityserver3

6
推荐指数
1
解决办法
3765
查看次数

标签 统计

c# ×1

identityserver3 ×1

oauth-2.0 ×1

openid-connect ×1