예제 #1
0
        public async static Task <JTWResponseToken> GenerateToken(ClaimsIdentity claimsIdentity, IJwtFactory IJwtFactory, string userName, JwtIssuerOptions jwtIssuerOptions)
        {
            var reponse = new JTWResponseToken();

            reponse.ID         = claimsIdentity.Claims.Single(c => c.Type == "id").Value;
            reponse.Auth_Token = await IJwtFactory.GenerateEncodedToken(userName, claimsIdentity);

            reponse.Expires_In = (int)jwtIssuerOptions.ValidFor.TotalSeconds;

            return(reponse);
        }
예제 #2
0
 public JwtFactory(IOptions <JwtIssuerOptions> jwtOptions)
 {
     _jwtOptions = jwtOptions.Value;
     ThrowIfInvalidOptions(_jwtOptions);
 }