Ejemplo n.º 1
0
        public JwtSecurityToken CreateJwtSecurityToken(TokenOption tokenOptions, User user, Microsoft.IdentityModel.Tokens.SigningCredentials signingCredentials, List <OperationClaim> operationClaims)
        {
            var jwt = new JwtSecurityToken(
                issuer: tokenOptions.Issuer,
                audience: tokenOptions.Audience,
                expires: _accessTokenExpiration,
                notBefore: DateTime.Now,
                claims: SetClaims(user, operationClaims),
                signingCredentials: signingCredentials
                );

            return(jwt);
        }
Ejemplo n.º 2
0
 public JwtHelper(IConfiguration configuration)
 {
     Configuration = configuration;
     _tokenOptions = Configuration.GetSection
                         ("TokenOptions").Get <TokenOption>();
 }