예제 #1
0
        public JwtSecurityToken CreateJwtSecurityToken(tokenOptions tokenOptions, user user,
                                                       SigningCredentials SigningCredentials, List <role> userRoles)
        {
            var jwt = new JwtSecurityToken(
                issuer: tokenOptions.Issuer,
                audience: tokenOptions.Audience,
                expires: DateTime.Now.AddMinutes(tokenOptions.accessTokenExpiration),
                notBefore: DateTime.Now,
                claims: setClaimsForUser(user, userRoles),
                signingCredentials: SigningCredentials
                );

            return(jwt);
        }
예제 #2
0
 public jwtHelper(IConfiguration configuration)
 {
     _configuration = configuration;
     _tokenOption   = _configuration.GetSection("TokenOptions").Get <tokenOptions>();
 }