public MailSender(IMailClient client, ITokenDecoder tokenDecoder, DataProtector dataProtector) { _client = client; _tokenDecoder = tokenDecoder; _dataProtector = dataProtector; }
public ParkingLotController(IApiHelper apiHelper, ITokenDecoder tokenDecoder, DataProtector dataProtector) { _apiHelper = apiHelper; _tokenDecoder = tokenDecoder; _dataProtector = dataProtector; }
public IdentityService(IUserIdentityService userIdentityService, ITokenDecoder tokenDecoder, IMapper mapper, IConfiguration configuration) { _userIdentityService = userIdentityService; _tokenDecoder = tokenDecoder; _mapper = mapper; _configuration = configuration; _discoveryUrl = _configuration.GetSection("ApplicationUrl").Value; _client = new HttpClient(); }
public UserController(IApiHelper apiHelper, ITokenDecoder tokenDecoder, DataProtector dataProtector, MailSender mailSender) { _apiHelper = apiHelper; _tokenDecoder = tokenDecoder; _dataProtector = dataProtector; _mailSender = mailSender; }
public BookingController(IApiHelper apiHelper, ITokenDecoder tokenDecoder, IConfiguration configuration, DataProtector dataProtector) { _apiHelper = apiHelper; _tokenDecoder = tokenDecoder; _dataProtector = dataProtector; _configuration = configuration; }
protected BaseAuthHandler( IOptionsMonitor <TOptions> options, ILoggerFactory loggerFactory, UrlEncoder encoder, ISystemClock clock, UserManager <AppUser> userManager, ITokenDecoder tokenDecoder) : base(options, loggerFactory, encoder, clock) { _userManager = userManager; _tokenDecoder = tokenDecoder; }
public HeadersAuthHandler(UserManager <AppUser> userManager, IOptionsMonitor <JwtAuthOptions> options, ILoggerFactory loggerFactory, UrlEncoder encoder, ISystemClock clock, ITokenDecoder tokenDecoder, IHeadersSessionManager sessionManager, ILogger <HeadersAuthHandler> logger) : base(options, loggerFactory, encoder, clock, userManager, tokenDecoder) { _sessionManager = sessionManager; _logger = logger; }
public static void JwtAuth(this IMiddlewareSupport middlewareSupport, ITokenDecoder <JwtToken> tokenDecoder, ILogger logger, Func <Request, bool> excludeFilter = null) { middlewareSupport.Use(async(context, next) => { if (excludeFilter != null && excludeFilter(context.Request)) { await next(context); return; } const string jwtHeaderPrefix = "Bearer "; if (!context.Request.Headers.ContainsKey("Authorization")) { await Task.Run(() => context.Response.StatusCode = HttpStatusCode.Unauthorized); return; } var authorizationHeader = context.Request.Headers["Authorization"].FirstOrDefault(); if (authorizationHeader == null || !authorizationHeader.StartsWith(jwtHeaderPrefix)) { await Task.Run(() => context.Response.StatusCode = HttpStatusCode.Unauthorized); return; } var token = authorizationHeader.Substring(jwtHeaderPrefix.Length); try { var payload = tokenDecoder.DecodeToken(token); var tokenExpires = ExpDateTimeConverter.ToDateTime(payload.exp); if (tokenExpires <= DateTime.UtcNow) { await Task.Run(() => context.Response.StatusCode = HttpStatusCode.Unauthorized); return; } context.Extensions.Register(new Session.Session(payload.username)); } catch (Exception e) { logger.LogError(e, $"Request {context.Request.Method} {context.Request.Url} unauthorized!"); await Task.Run(() => context.Response.StatusCode = HttpStatusCode.Unauthorized); return; } await next(context); }); }
public CookieAuthHandler( UserManager <AppUser> userManager, IOptionsMonitor <CookieAuthOptions> options, ILoggerFactory loggerFactory, UrlEncoder encoder, ISystemClock clock, ITokenDecoder tokenDecoder, ICookieSessionManager jwtCookieSessionManager, ILogger <CookieAuthHandler> logger) : base(options, loggerFactory, encoder, clock, userManager, tokenDecoder) { _userManager = userManager; _tokenDecoder = tokenDecoder; _jwtCookieSessionManager = jwtCookieSessionManager; _logger = logger; }
public AccountController(UserManager <AppUser> userManager, IHttpContextAccessor httpContextAccessor, ITokenDecoder tokenDecoder, SignInManager <AppUser> signInManager, ICookieSessionManager cookieSessionManager, IHeadersSessionManager headersSessionManager, ILogger <RefreshTokenProvider> logger, UsersDbContext dbContext) { _userManager = userManager; _httpContextAccessor = httpContextAccessor; _tokenDecoder = tokenDecoder; _signInManager = signInManager; _cookieSessionManager = cookieSessionManager; _headersSessionManager = headersSessionManager; _logger = logger; _dbContext = dbContext; }
public AuthorizationFilter(ITokenDecoder tokenDecoder, string role) { _tokenDecoder = tokenDecoder; _role = role; }
public NodeSerializer(IContainer cont, ITokenDecoder tokenValidator) { _container = cont; this.tokenValidator = tokenValidator; }
public ApiHelper(IConfiguration configuration, ITokenDecoder tokenDecoder) { _configuration = configuration; _tokenDecoder = tokenDecoder; }