// 生成Token通用 private string CreateToken(List <Claim> claims, EnumTokenType tokenType) { var key = new SymmetricSecurityKey(System.Text.Encoding.UTF8.GetBytes(_mbpConfigs.Value.Jwt.SecurityKey)); var expires = tokenType == EnumTokenType.AccessToken ? DateTime.Now.AddMinutes(_mbpConfigs.Value.Jwt.TimeOut) : DateTime.Now.AddMinutes(_mbpConfigs.Value.Jwt.RefreshTimeOut); var token = new JwtSecurityToken( issuer: _mbpConfigs.Value.Jwt.Issuer, audience: tokenType == EnumTokenType.AccessToken ? _mbpConfigs.Value.Jwt.Audience : "refreshToken", claims: claims, notBefore: DateTime.Now, expires: expires, signingCredentials: new SigningCredentials(key, SecurityAlgorithms.HmacSha256)); return(new JwtSecurityTokenHandler().WriteToken(token)); }
public Token(string value, EnumTokenType type) { this.value = value; this.type = type; }
public TokenFilter(EnumTokenType enumTokenType) { _enumTokenType = enumTokenType; }
public Token(string text, EnumTokenType type) { this.text = text; this.type = type; }