Пример #1
0
 public JwtHelper(IConfiguration _configuration)
 {
     configuration         = _configuration;
     tokenOptions          = configuration.GetSection(key: "TokenOptions").Get <TokenOptions>();
     accessTokenExpiration = DateTime.Now.AddMinutes(tokenOptions.AccessTokenExpiration);
 }
Пример #2
0
        public JwtSecurityToken CreateJwtSecurityToken(TokenOptions tokenOptions, User user, 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);
        }
Пример #3
0
 public JwtHelper(IConfiguration configuration)
 {
     Configuration = configuration;
     _tokenOptions = Configuration.GetSection("TokenOptions").Get <TokenOptions>();
 }