/// <summary>
        /// Initializes a <see cref="AdfsCreatingTicketContext"/>
        /// </summary>
        /// <param name="context">The HTTP environment.</param>
        /// <param name="options">The options used by the authentication middleware.</param>
        /// <param name="backchannel">The HTTP client used by the authentication middleware</param>
        /// <param name="token">The tokens returned from the token endpoint.</param>
        /// <param name="user">The de-serialized user.</param>
        public AdfsCreatingTicketContext(
            IOwinContext context,
            AdfsOptions options,
            HttpClient backchannel,
            AdfsOAuthTokenResponse token)
            : base(context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

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

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

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

            TokenResponse = token;
            Backchannel   = backchannel;
            Options       = options;
        }
 /// <summary>
 /// Creates a new context object.
 /// </summary>
 /// <param name="context">The owin request context.</param>
 /// <param name="options"></param>
 /// <param name="properties">The authentication properties of the challenge.</param>
 /// <param name="redirectUri">The initial redirect URI.</param>
 public AdfsRedirectToAuthorizationContext(
     IOwinContext context,
     AdfsOptions options,
     AuthenticationProperties properties,
     string redirectUri)
     : base(context)
 {
     RedirectUri = redirectUri;
     Properties = properties;
     Options = options;
 }
Exemple #3
0
 /// <summary>
 /// Creates a new context object.
 /// </summary>
 /// <param name="context">The owin request context.</param>
 /// <param name="options"></param>
 /// <param name="properties">The authentication properties of the challenge.</param>
 /// <param name="redirectUri">The initial redirect URI.</param>
 public AdfsRedirectToAuthorizationContext(
     IOwinContext context,
     AdfsOptions options,
     AuthenticationProperties properties,
     string redirectUri)
     : base(context)
 {
     RedirectUri = redirectUri;
     Properties  = properties;
     Options     = options;
 }
        /// <summary>
        /// Adds the <see cref="AdfsMiddleware"/> middleware to the specified <see cref="IAppBuilder"/>, which enables Adfs 3.0's OAuth2 capabilities.
        /// </summary>
        /// <param name="app">The <see cref="IAppBuilder"/> to add the middleware to.</param>
        /// <param name="configureOptions">An action delegate to configure the provided <see cref="AdfsOptions"/>.</param>
        /// <returns>A reference to this instance after the operation has completed.</returns>
        public static IAppBuilder UseAdfsOAuth2Authentication(this IAppBuilder app, Action<AdfsOptions> configureOptions)
        {
            if (app == null)
                throw new ArgumentNullException("app");

            var options = new AdfsOptions();
            if (configureOptions != null)
            {
                configureOptions(options);
            }
            return app.UseAdfsOAuth2Authentication(options);
        }
        /// <summary>
        /// Authenticate users using Adfs 3.0's OAuth2 endpoints
        /// </summary>
        /// <param name="app">The <see cref="IAppBuilder"/> passed to the configuration method</param>
        /// <param name="options">Middleware configuration options</param>
        /// <returns>The updated <see cref="IAppBuilder"/></returns>
        public static IAppBuilder UseAdfsOAuth2Authentication(this IAppBuilder app, AdfsOptions options)
        {
            if (app == null)
                throw new ArgumentNullException("app");

            if (options == null)
                throw new ArgumentNullException("options");

            app.Use(typeof(AdfsMiddleware), app, options);

            return app;
        }
        public AdfsTicketReceivedContext(
            IOwinContext context,
            AdfsOptions options,
            AuthenticationTicket ticket)
            : base(context)
        {
            if (options == null) throw new ArgumentNullException("options");

            Options = options;
            SignInScheme = options.SignInScheme;
            AuthenticationTicket = ticket;
            if (ticket != null)
            {
                Identity = ticket.Identity;
                Properties = ticket.Properties;
                ReturnUri = ticket.Properties.RedirectUri;
            }
        }
        public AdfsTicketReceivedContext(
            IOwinContext context,
            AdfsOptions options,
            AuthenticationTicket ticket)
            : base(context)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            Options              = options;
            SignInScheme         = options.SignInScheme;
            AuthenticationTicket = ticket;
            if (ticket != null)
            {
                Identity   = ticket.Identity;
                Properties = ticket.Properties;
                ReturnUri  = ticket.Properties.RedirectUri;
            }
        }
        /// <summary>
        /// Initializes a <see cref="AdfsCreatingTicketContext"/>
        /// </summary>
        /// <param name="context">The HTTP environment.</param>
        /// <param name="options">The options used by the authentication middleware.</param>
        /// <param name="backchannel">The HTTP client used by the authentication middleware</param>
        /// <param name="token">The tokens returned from the token endpoint.</param>
        /// <param name="user">The de-serialized user.</param>
        public AdfsCreatingTicketContext(
            IOwinContext context,
            AdfsOptions options,
            HttpClient backchannel,
            AdfsOAuthTokenResponse token)
            : base(context)
        {
            if (context == null)
                throw new ArgumentNullException("context");

            if (options == null)
                throw new ArgumentNullException("options");

            if (backchannel == null)
                throw new ArgumentNullException("backchannel");

            if (token == null)
                throw new ArgumentNullException("token");

            TokenResponse = token;
            Backchannel = backchannel;
            Options = options;
        }