nbarbettini/SimpleTokenProvider

Implement Authorization

Opened this issue · 0 comments

How can i implement Authorization claim based . I have tried but not working properly if i generate 2 token first for 'Administrator' and second for 'User'. the last token also getting the previous role. find the below code.
In TokenProviderMiddleware.cs class.

  var claims = new Claim[]
                {
                new Claim(JwtRegisteredClaimNames.Sub, username),
                new Claim(JwtRegisteredClaimNames.Jti, await _options.NonceGenerator())
                ,new Claim("roles",role)
                ,new Claim("userId",userId)
                    //  new Claim(JwtRegisteredClaimNames.Iat, ToUnixEpochDate(now).ToString(), ClaimValueTypes.Integer64)
                };