示例#1
0
 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;
 }
示例#2
0
 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;
 }
示例#3
0
        /// <summary>
        /// Enables basic authentication for the application
        /// </summary>
        /// <param name="pipelines">
        /// Pipelines to add handlers to (usually "this")
        /// </param>
        /// <param name="configuration">
        /// Forms authentication configuration
        /// </param>
        /// <param name="basicAuthenticationPaths">
        /// The basic Authentication Paths. Each supplied path shall be preceded by a '/' character.
        /// </param>
        public void Enable(
            IPipelines pipelines,
            CDP4WebServiceAuthenticationConfiguration configuration,
            IEnumerable <string> basicAuthenticationPaths)
        {
            if (pipelines == null)
            {
                throw new ArgumentNullException("pipelines");
            }

            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            this.currentConfiguration = configuration;
            this.cookieSessionManager = new CookieSessionManager();

            pipelines.BeforeRequest.AddItemToStartOfPipeline(this.GetCredentialRetrievalHook);
            pipelines.AfterRequest.AddItemToEndOfPipeline(
                context => this.GetAuthenticationPromptHook(context, basicAuthenticationPaths));
        }