ASOS-JWT令牌声明在角度的解码令牌中不可见

时间:2018-11-19 14:14:59

标签: jwt asp.net-identity openid-connect

在.net 4.6中,我编写了一个自定义的jwt令牌处理程序,并能够通过使用angular-jwt在客户端解析令牌。

但是,在.Net core中并使用ASOS,我在启动后的几行中添加了相同的令牌。

options.AccessTokenHandler = new JwtSecurityTokenHandler
                     {
                         InboundClaimTypeMap = new Dictionary<string, string>(),
                         OutboundClaimTypeMap = new Dictionary<string, string>()
                     };

这是添加声明的代码。

var identity = new ClaimsIdentity(schemeName, OpenIdConnectConstants.Claims.Name,
                            OpenIdConnectConstants.Claims.Role);
           identity.AddClaim(OpenIdConnectConstants.Claims.Subject, "1"); 
           identity.AddClaim(OpenIdConnectConstants.Claims.Name, userName);
          identity.AddClaim(OpenIdConnectConstants.Claims.Role, "Admin");

但是,在角度方面,已解码令牌没有所有声明。我只看到sub,没有别的。 这是我的角度代码。

var decodedValue = this.jwtHelper.decodeToken(variable.access_token);

不确定我想念什么。

0 个答案:

没有答案