/// <summary>
 /// Creates a new instance of the context object.
 /// </summary>
 /// <param name="context">The HTTP request context</param>
 /// <param name="options">The middleware options</param>
 /// <param name="authenticationScheme">Initializes AuthenticationScheme property</param>
 public SidSetCurrentContext(
     HttpContext context,
     SidAuthenticationOptions options,
     string authenticationScheme,
     ClaimsPrincipal principal) : base(context, options)
 {
     AuthenticationScheme = authenticationScheme;
     Principal            = principal;
 }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="context"></param>
 /// <param name="options"></param>
 /// <param name="properties"></param>
 /// <param name="cookieOptions"></param>
 public SidSigningOutContext(
     HttpContext context,
     SidAuthenticationOptions options,
     AuthenticationProperties properties,
     CookieOptions cookieOptions) : base(context, options)
 {
     CookieOptions = cookieOptions;
     Properties    = properties;
 }
 public SidSigningInContext(
     HttpContext context,
     SidAuthenticationOptions options,
     string authenticationScheme,
     ClaimsPrincipal principal,
     AuthenticationProperties properties,
     CookieOptions cookieOptions) : base(context, options)
 {
     AuthenticationScheme = authenticationScheme;
     Principal            = principal;
     Properties           = properties;
     CookieOptions        = cookieOptions;
 }
Exemple #4
0
 /// <summary>
 /// Creates a new instance of the context object.
 /// </summary>
 /// <param name="context">The HTTP request context</param>
 /// <param name="options">The middleware options</param>
 /// <param name="authenticationScheme">Initializes AuthenticationScheme property</param>
 /// <param name="principal">Initializes Principal property</param>
 /// <param name="properties">Initializes Properties property</param>
 /// <param name="sid">Initializes Sid property</param>
 public SidSignedInContext(
     HttpContext context,
     SidAuthenticationOptions options,
     string authenticationScheme,
     ClaimsPrincipal principal,
     AuthenticationProperties properties,
     string sid) : base(context, options)
 {
     AuthenticationScheme = authenticationScheme;
     Principal            = principal;
     Properties           = properties;
     Sid     = sid;
     Success = true;
 }
        /// <summary>
        /// Creates a new instance of the context object.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="ticket">Contains the initial values for identity and extra data</param>
        /// <param name="options"></param>
        public SidValidatePrincipalContext(
            HttpContext context,
            AuthenticationTicket ticket,
            SidAuthenticationOptions 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;
        }
Exemple #6
0
        /// <summary>
        /// Adds the <see cref="SidAuthenticationMiddleware"/> middleware to the specified <see cref="IApplicationBuilder"/>, which enables sid authentication capabilities.
        /// </summary>
        /// <param name="app">The <see cref="IApplicationBuilder"/> to add the middleware to.</param>
        /// <param name="options">A <see cref="SidAuthenticationOptions"/> that specifies options for the middleware.</param>
        /// <returns>A reference to this instance after the operation has completed.</returns>
        public static IApplicationBuilder UseSidAuthentication(this IApplicationBuilder app, SidAuthenticationOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }

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

            return(app.UseMiddleware <SidAuthenticationMiddleware>(Options.Create(options)));
        }
Exemple #7
0
 public BaseSidContext(
     HttpContext context,
     SidAuthenticationOptions options) : base(context)
 {
     Options = options ?? throw new ArgumentNullException(nameof(options));
 }