public AuthController(IAuthService authService, IJWTSettings jwtSettings, IAccountService accountService, IMasterService masterService) { _authService = authService; _jwtSettings = jwtSettings; _accountService = accountService; _masterService = masterService; }
public AuthController(IAuthService authService, IUserService userService, IJWTSettings jwtSettings) { _jwtSettings = jwtSettings; _authService = authService; _userService = userService; }
public TokenDecoder(IJWTSettings jwtSettings) { this.jwtSettings = jwtSettings; this.validationParameters = new TokenValidationParameters { ValidateIssuerSigningKey = true, IssuerSigningKey = jwtSettings.GetSecurityKey(), ValidateIssuer = false, ValidateAudience = false }; }
private async Task <string> GenerateToken(User user, IJWTSettings jwtSettings) { var tokenHandler = new JwtSecurityTokenHandler(); var key = Encoding.ASCII.GetBytes(jwtSettings.Key); var tokenDescriptor = new SecurityTokenDescriptor { Subject = new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()), new Claim(ClaimTypes.Name, user.Email), new Claim(ClaimTypes.Role, user.Role) }), Issuer = "", Expires = DateTime.Now.AddDays(jwtSettings.ExpiryDays), SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha512Signature) }; var token = tokenHandler.CreateToken(tokenDescriptor); return(await Task.FromResult(tokenHandler.WriteToken(token))); }
public JWTService(IJWTSettings jwtSettings) { _jwtSettings = jwtSettings; }
public JWTService(IJWTSettings settings) { _key = settings.Key; _issuer = settings.Issuer; }
public AuthorizationController(IJWTSettings jwtSettings, DiscordService discordService, CampaignSaberContext campaignSaberContext) { _jwtSettings = jwtSettings; _discordService = discordService; _campaignSaberContext = campaignSaberContext; }
public JWTValidator(RequestDelegate next, IJWTSettings jwtSettings) { _next = next; _jwtSettings = jwtSettings; }
public GoogleTokenValidator(IJWTSettings settings) { this.settings = settings; }
public JWTService(IJWTSettings jwtSettings, IJwtDecoder jwtDecoder, IJwtEncoder jwtEncoder) { _key = jwtSettings.Key; _decoder = jwtDecoder; _encoder = jwtEncoder; }