Exemple #1
0
        public static string CreateTokenJson(UserDto user, IJWTConfig jwtConfig)
        {
            var claims = new List <Claim>
            {
                new Claim(JwtRegisteredClaimNames.Sub, user.Id.ToString())
            };

            var token     = new JwtSecurityToken(jwtConfig.Issuer, jwtConfig.Audience, claims, DateTime.Now, DateTime.Now.AddDays(1), CreateTokenSignInCredential(jwtConfig.TokenSecurityKey));
            var tokenJson = new JwtSecurityTokenHandler().WriteToken(token);

            return(tokenJson);
        }
Exemple #2
0
 public TokenInfoExtractorImpl(Protocols.IJWTConfig jWTConfig)
 {
     _jWTConfig = jWTConfig;
 }
Exemple #3
0
 public TokenCreatorImpl(Protocols.IJWTConfig jWTConfig)
 {
     _jWTConfig = jWTConfig;
 }