using Microsoft.AspNet.Authentication;
using Microsoft.AspNet.Http;
using System;
namespace OAuth.AspNet.AuthServer
{
///
/// Provides notification used for determining the OAuth flow type based on the request.
///
public class OAuthMatchContext : BaseControlContext
{
#region Constructors
///
/// Initializes a new instance of the class
///
///
///
public OAuthMatchContext(HttpContext context, OAuthAuthorizationServerOptions options) : base(context)
{
if (options == null)
throw new ArgumentNullException(nameof(options));
Options = options;
}
#endregion
#region Public Members
public OAuthAuthorizationServerOptions Options { get; }
///
/// Gets whether or not the endpoint is an OAuth authorize endpoint.
///
public bool IsAuthorizeEndpoint { get; private set; }
///
/// Gets whether or not the endpoint is an OAuth token endpoint.
///
public bool IsTokenEndpoint { get; private set; }
///
/// Sets the endpoint type to authorize endpoint.
///
public void MatchesAuthorizeEndpoint()
{
IsAuthorizeEndpoint = true;
IsTokenEndpoint = false;
}
///
/// Sets the endpoint type to token endpoint.
///
public void MatchesTokenEndpoint()
{
IsAuthorizeEndpoint = false;
IsTokenEndpoint = true;
}
///
/// Sets the endpoint type to neither authorize nor token.
///
public void MatchesNothing()
{
IsAuthorizeEndpoint = false;
IsTokenEndpoint = false;
}
#endregion
}
}