/// <summary> /// Creates a new instance of <see cref="BaseOAuthEndpointContext"/>. /// </summary> /// <param name="context">The <see cref="HttpContext"/> to use for this endpoint context.</param> /// <param name="options">The <see cref="OAuthAuthorizationServerOptions"/> to use for this endpoint context.</param> public BaseOAuthEndpointContext(HttpContext context, OAuthAuthorizationServerOptions options) : base(context) { if (options == null) throw new ArgumentNullException(nameof(options)); Options = options; }
/// <summary> /// Adds OAuth2 Authorization Server capabilities to an OWIN web application. This middleware /// performs the request processing for the Authorize and Token endpoints defined by the OAuth2 specification. /// See also http://tools.ietf.org/html/rfc6749 /// </summary> /// <param name="app">The web application builder</param> /// <param name="options">Options which control the behavior of the Authorization Server.</param> /// <returns>The application builder</returns> public static IApplicationBuilder UseOAuthAuthorizationServer(this IApplicationBuilder app, OAuthAuthorizationServerOptions options) { if (app == null) throw new NullReferenceException($"The extension method {nameof(OAuthAuthorizationServerExtensions.UseOAuthAuthorizationServer)} was called on a null reference to a {nameof(IApplicationBuilder)}"); if (options == null) throw new ArgumentNullException(nameof(options)); return app.UseMiddleware<OAuthAuthorizationServerMiddleware>(options); }
/// <summary> /// Adds OAuth2 Authorization Server capabilities to an OWIN web application. This middleware /// performs the request processing for the Authorize and Token endpoints defined by the OAuth2 specification. /// See also http://tools.ietf.org/html/rfc6749 /// </summary> /// <param name="app">The web application builder</param> /// <param name="configureOptions">Options which control the behavior of the Authorization Server.</param> /// <returns>The application builder</returns> public static IApplicationBuilder UseOAuthAuthorizationServer(this IApplicationBuilder app, Action<OAuthAuthorizationServerOptions> configureOptions) { if (app == null) throw new NullReferenceException($"The extension method {nameof(OAuthAuthorizationServerExtensions.UseOAuthAuthorizationServer)} was called on a null reference to a {nameof(IApplicationBuilder)}"); if (configureOptions == null) throw new ArgumentNullException(nameof(configureOptions)); var options = new OAuthAuthorizationServerOptions(); if (configureOptions != null) configureOptions(options); return app.UseOAuthAuthorizationServer(options); }
/// <summary> /// Initializes a new instance of the <see cref="OAuthAuthorizationEndpointResponseContext"/> class /// </summary> /// <param name="context"></param> /// <param name="options"></param> /// <param name="ticket"></param> /// <param name="tokenEndpointRequest"></param> public OAuthAuthorizationEndpointResponseContext(HttpContext context, OAuthAuthorizationServerOptions options, AuthenticationTicket ticket, AuthorizeEndpointRequest authorizeEndpointRequest, string accessToken, string authorizationCode) : base(context, options) { if (ticket == null) { throw new ArgumentNullException("ticket"); } Principal = ticket.Principal; Properties = ticket.Properties; AuthorizeEndpointRequest = authorizeEndpointRequest; AdditionalResponseParameters = new Dictionary<string, object>(StringComparer.Ordinal); AccessToken = accessToken; AuthorizationCode = authorizationCode; }
/// <summary> /// Creates an instance of this context /// </summary> public OAuthAuthorizeEndpointContext(HttpContext context, OAuthAuthorizationServerOptions options, AuthorizeEndpointRequest authorizeRequest) : base(context, options) { AuthorizeRequest = authorizeRequest; }
/// <summary> /// Initializes a new instance of the <see cref="OAuthValidateClientAuthenticationContext"/> class /// </summary> /// <param name="context"></param> /// <param name="options"></param> /// <param name="parameters"></param> public OAuthValidateClientAuthenticationContext(HttpContext context, OAuthAuthorizationServerOptions options, IReadableStringCollection parameters) : base(context, options, null) { Parameters = parameters; }
public OAuthValidateClientRedirectUriContext(HttpContext context, OAuthAuthorizationServerOptions options, string clientId, string redirectUri) : base(context, options, clientId) { RedirectUri = redirectUri; }
/// <summary> /// Initializes a new instance of the <see cref="OAuthValidateClientAuthenticationContext"/> class /// </summary> /// <param name="context"></param> /// <param name="options"></param> /// <param name="parameters"></param> public OAuthValidateClientAuthenticationContext(HttpContext context, OAuthAuthorizationServerOptions options, IDictionary<string, StringValues> parameters) : base(context, options, null) { Parameters = parameters; }