public static IApplicationBuilder UseBearerAuthentication(this IApplicationBuilder app, BearerAuthenticationOptions options)
 {
     if (app == null)
         throw new ArgumentNullException(nameof(app));
     if (options == null)
         throw new ArgumentNullException(nameof(options));
     return app.UseMiddleware<BearerAuthenticationMiddleware>(options);
 }
 public static IApplicationBuilder UseBearerAuthentication(this IApplicationBuilder app, Action<BearerAuthenticationOptions> configureOptions)
 {
     if (app == null)
         throw new ArgumentNullException(nameof(app));
     var options = new BearerAuthenticationOptions();
     configureOptions?.Invoke(options);
     return UseBearerAuthentication(app, options);
 }
コード例 #3
0
 public BearerTokenService(
     IOptions <AuthenticationOptions> authenticationOptionsAccessor,
     IUserManager userManager,
     IUnitOfWork unitOfWork
     ) : base(unitOfWork)
 {
     _authenticationOptions = authenticationOptionsAccessor.Value.Bearer;
     _userManager           = userManager;
 }
コード例 #4
0
        public BaseBearerContext(
            HttpContext context,
            BearerAuthenticationOptions options)
            : base(context)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            Options = options;
        }
コード例 #5
0
 public BearerSignedInContext(
     HttpContext context,
     BearerAuthenticationOptions options,
     string authenticationScheme,
     ClaimsPrincipal principal,
     AuthenticationProperties properties)
     : base(context, options)
 {
     AuthenticationScheme = authenticationScheme;
     Principal            = principal;
     Properties           = properties;
 }
コード例 #6
0
 public BearerUnauthorizedContext(HttpContext context, BearerAuthenticationOptions options)
     : base(context, options)
 {
 }
コード例 #7
0
 public BearerBaseContext(HttpContext context, BearerAuthenticationOptions options)
     : base(context)
 {
     Options = options;
 }
コード例 #8
0
 public BearerForbiddenContext(HttpContext context, BearerAuthenticationOptions options)
     : base(context, options)
 {
 }
コード例 #9
0
 public BearerSigningOutContext(HttpContext context, BearerAuthenticationOptions options)
     : base(context, options)
 {
 }
コード例 #10
0
 public BearerValidatePrincipalContext(HttpContext context, BearerAuthenticationOptions options, ClaimsPrincipal principal, AuthenticationProperties properties)
     : base(context, options)
 {
     Principal = principal;
     Properties = properties;
 }
コード例 #11
0
        /// <summary>
        /// Adds the <see cref="BearerAuthenticationMiddleware"/> middleware to the specified <see cref="IApplicationBuilder"/>, which enables bearer authentication capabilities.
        /// </summary>
        /// <param name="app">The <see cref="IApplicationBuilder"/> to add the middleware to.</param>
        /// <param name="options">A <see cref="BearerAuthenticationOptions"/> that specifies options for the middleware.</param>
        /// <returns>A reference to this instance after the operation has completed.</returns>
        public static IApplicationBuilder UseBearerAuthentication(this IApplicationBuilder app, BearerAuthenticationOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return(app.UseMiddleware <BearerAuthenticationMiddleware>(Options.Create(options)));
        }
コード例 #12
0
        public BearerValidatePrincipalContext(HttpContext context, AuthenticationTicket ticket, BearerAuthenticationOptions options)
            : base(context, options)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (ticket == null)
            {
                throw new ArgumentNullException(nameof(ticket));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            Principal  = ticket.Principal;
            Properties = ticket.Properties;
        }