diff --git a/src/Microsoft.AspNet.Security.Facebook/FacebookAuthenticationExtensions.cs b/src/Microsoft.AspNet.Security.Facebook/FacebookAuthenticationExtensions.cs
index cdaade120..b261bed2e 100644
--- a/src/Microsoft.AspNet.Security.Facebook/FacebookAuthenticationExtensions.cs
+++ b/src/Microsoft.AspNet.Security.Facebook/FacebookAuthenticationExtensions.cs
@@ -32,7 +32,7 @@ public static IBuilder UseFacebookAuthentication([NotNull] this IBuilder app, [N
/// The passed to the configure method
/// Middleware configuration options
/// The updated
- public static IBuilder UseFacebookAuthentication([NotNull] this IBuilder app, [NotNull] FacebookAuthenticationOptions options)
+ public static IBuilder UseFacebookAuthentication([NotNull] this IBuilder app, [NotNull] IFacebookAuthenticationOptions options)
{
if (string.IsNullOrEmpty(options.SignInAsAuthenticationType))
{
diff --git a/src/Microsoft.AspNet.Security.Facebook/FacebookAuthenticationHandler.cs b/src/Microsoft.AspNet.Security.Facebook/FacebookAuthenticationHandler.cs
index 4dde8b75d..90d188bb4 100644
--- a/src/Microsoft.AspNet.Security.Facebook/FacebookAuthenticationHandler.cs
+++ b/src/Microsoft.AspNet.Security.Facebook/FacebookAuthenticationHandler.cs
@@ -18,7 +18,7 @@
namespace Microsoft.AspNet.Security.Facebook
{
- internal class FacebookAuthenticationHandler : AuthenticationHandler
+ internal class FacebookAuthenticationHandler : AuthenticationHandler
{
private const string XmlSchemaString = "http://www.w3.org/2001/XMLSchema#string";
private const string TokenEndpoint = "https://graph.facebook.com/oauth/access_token";
diff --git a/src/Microsoft.AspNet.Security.Facebook/FacebookAuthenticationMiddleware.cs b/src/Microsoft.AspNet.Security.Facebook/FacebookAuthenticationMiddleware.cs
index 895c7b08d..ed3681bfa 100644
--- a/src/Microsoft.AspNet.Security.Facebook/FacebookAuthenticationMiddleware.cs
+++ b/src/Microsoft.AspNet.Security.Facebook/FacebookAuthenticationMiddleware.cs
@@ -17,7 +17,7 @@ namespace Microsoft.AspNet.Security.Facebook
/// ASP.NET middleware for authenticating users using Facebook
///
[SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable", Justification = "Middleware is not disposable.")]
- public class FacebookAuthenticationMiddleware : AuthenticationMiddleware
+ public class FacebookAuthenticationMiddleware : AuthenticationMiddleware
{
private readonly ILogger _logger;
private readonly HttpClient _httpClient;
@@ -32,7 +32,7 @@ public FacebookAuthenticationMiddleware(
IDataProtectionProvider dataProtectionProvider,
ILoggerFactory loggerFactory,
IServiceProvider services,
- FacebookAuthenticationOptions options)
+ IFacebookAuthenticationOptions options)
: base(next, options)
{
if (string.IsNullOrWhiteSpace(Options.AppId))
@@ -65,14 +65,14 @@ public FacebookAuthenticationMiddleware(
///
/// Provides the object for processing authentication-related requests.
///
- /// An configured with the supplied to the constructor.
- protected override AuthenticationHandler CreateHandler()
+ /// An configured with the supplied to the constructor.
+ protected override AuthenticationHandler CreateHandler()
{
return new FacebookAuthenticationHandler(_httpClient, _logger);
}
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "Managed by caller")]
- private static HttpMessageHandler ResolveHttpMessageHandler(FacebookAuthenticationOptions options)
+ private static HttpMessageHandler ResolveHttpMessageHandler(IFacebookAuthenticationOptions options)
{
HttpMessageHandler handler = options.BackchannelHttpHandler ??
#if NET45
diff --git a/src/Microsoft.AspNet.Security.Facebook/FacebookAuthenticationOptions.cs b/src/Microsoft.AspNet.Security.Facebook/FacebookAuthenticationOptions.cs
index 983273446..3b8cdbb37 100644
--- a/src/Microsoft.AspNet.Security.Facebook/FacebookAuthenticationOptions.cs
+++ b/src/Microsoft.AspNet.Security.Facebook/FacebookAuthenticationOptions.cs
@@ -13,7 +13,7 @@ namespace Microsoft.AspNet.Security.Facebook
///
/// Configuration options for
///
- public class FacebookAuthenticationOptions : AuthenticationOptions
+ public class FacebookAuthenticationOptions : AuthenticationOptions, IFacebookAuthenticationOptions
{
///
/// Initializes a new
diff --git a/src/Microsoft.AspNet.Security.Facebook/IFacebookAuthenticationOptions.cs b/src/Microsoft.AspNet.Security.Facebook/IFacebookAuthenticationOptions.cs
new file mode 100644
index 000000000..92ad69755
--- /dev/null
+++ b/src/Microsoft.AspNet.Security.Facebook/IFacebookAuthenticationOptions.cs
@@ -0,0 +1,88 @@
+using System;
+using System.Net.Http;
+using Microsoft.AspNet.Http;
+using Microsoft.AspNet.Http.Security;
+using System.Collections.Generic;
+
+namespace Microsoft.AspNet.Security.Facebook
+{
+ ///
+ /// Summary description for IFacebookAuthenticationOptions
+ ///
+ public interface IFacebookAuthenticationOptions : IAuthenticationOptions
+ {
+ ///
+ /// Gets or sets the Facebook-assigned appId
+ ///
+ string AppId { get; set; }
+
+ ///
+ /// Gets or sets the Facebook-assigned app secret
+ ///
+ string AppSecret { get; set; }
+#if NET45
+ ///
+ /// Gets or sets the a pinned certificate validator to use to validate the endpoints used
+ /// in back channel communications belong to Facebook.
+ ///
+ ///
+ /// The pinned certificate validator.
+ ///
+ /// If this property is null then the default certificate checks are performed,
+ /// validating the subject name and if the signing chain is a trusted party.
+ ICertificateValidator BackchannelCertificateValidator { get; set; }
+#endif
+ ///
+ /// Gets or sets timeout value in milliseconds for back channel communications with Facebook.
+ ///
+ ///
+ /// The back channel timeout in milliseconds.
+ ///
+ TimeSpan BackchannelTimeout { get; set; }
+
+ ///
+ /// The HttpMessageHandler used to communicate with Facebook.
+ /// This cannot be set at the same time as BackchannelCertificateValidator unless the value
+ /// can be downcast to a WebRequestHandler.
+ ///
+ HttpMessageHandler BackchannelHttpHandler { get; set; }
+
+ ///
+ /// Get or sets the text that the user can display on a sign in user interface.
+ ///
+ string Caption { get; set; }
+
+ ///
+ /// The request path within the application's base path where the user-agent will be returned.
+ /// The middleware will process this request when it arrives.
+ /// Default value is "/signin-facebook".
+ ///
+ PathString CallbackPath { get; set; }
+
+ ///
+ /// Gets or sets the name of another authentication middleware which will be responsible for actually issuing a user .
+ ///
+ string SignInAsAuthenticationType { get; set; }
+
+ ///
+ /// Gets or sets the used to handle authentication events.
+ ///
+ IFacebookAuthenticationNotifications Notifications { get; set; }
+
+ ///
+ /// Gets or sets the type used to secure data handled by the middleware.
+ ///
+ ISecureDataFormat StateDataFormat { get; set; }
+
+ ///
+ /// A list of permissions to request.
+ ///
+ IList Scope { get; }
+
+ ///
+ /// Gets or sets if the appsecret_proof should be generated and sent with Facebook API calls.
+ /// This is enabled by default.
+ ///
+ bool SendAppSecretProof { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.AspNet.Security.Facebook/Notifications/FacebookApplyRedirectContext.cs b/src/Microsoft.AspNet.Security.Facebook/Notifications/FacebookApplyRedirectContext.cs
index 020e2d32e..ec13b75d6 100644
--- a/src/Microsoft.AspNet.Security.Facebook/Notifications/FacebookApplyRedirectContext.cs
+++ b/src/Microsoft.AspNet.Security.Facebook/Notifications/FacebookApplyRedirectContext.cs
@@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Security.Facebook
///
/// Context passed when a Challenge causes a redirect to authorize endpoint in the Facebook middleware
///
- public class FacebookApplyRedirectContext : BaseContext
+ public class FacebookApplyRedirectContext : BaseContext
{
///
/// Creates a new context object.
@@ -21,7 +21,7 @@ public class FacebookApplyRedirectContext : BaseContextThe initial redirect URI
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", MessageId = "3#",
Justification = "Represents header value")]
- public FacebookApplyRedirectContext(HttpContext context, FacebookAuthenticationOptions options,
+ public FacebookApplyRedirectContext(HttpContext context, IFacebookAuthenticationOptions options,
AuthenticationProperties properties, string redirectUri)
: base(context, options)
{
diff --git a/src/Microsoft.AspNet.Security/AuthenticationOptions.cs b/src/Microsoft.AspNet.Security/AuthenticationOptions.cs
index 77e8fa03a..70d16eec8 100644
--- a/src/Microsoft.AspNet.Security/AuthenticationOptions.cs
+++ b/src/Microsoft.AspNet.Security/AuthenticationOptions.cs
@@ -3,17 +3,14 @@
using System;
-using System.Collections.Generic;
using Microsoft.AspNet.Http.Security;
-using Microsoft.AspNet.HttpFeature.Security;
-using Microsoft.AspNet.PipelineCore.Security;
namespace Microsoft.AspNet.Security
{
///
/// Base Options for all authentication middleware
///
- public abstract class AuthenticationOptions
+ public abstract class AuthenticationOptions : IAuthenticationOptions
{
private string _authenticationType;
diff --git a/src/Microsoft.AspNet.Security/IAuthenticationOptions.cs b/src/Microsoft.AspNet.Security/IAuthenticationOptions.cs
new file mode 100644
index 000000000..3e244dac0
--- /dev/null
+++ b/src/Microsoft.AspNet.Security/IAuthenticationOptions.cs
@@ -0,0 +1,28 @@
+using Microsoft.AspNet.Http.Security;
+
+namespace Microsoft.AspNet.Security
+{
+ ///
+ /// Interface for Base Options for all authentication middleware
+ ///
+ public interface IAuthenticationOptions
+ {
+ ///
+ /// The AuthenticationType in the options corresponds to the IIdentity AuthenticationType property. A different
+ /// value may be assigned in order to use the same authentication middleware type more than once in a pipeline.
+ ///
+ string AuthenticationType { get;set; }
+
+ ///
+ /// If Active the authentication middleware alter the request user coming in and
+ /// alter 401 Unauthorized responses going out. If Passive the authentication middleware will only provide
+ /// identity and alter responses when explicitly indicated by the AuthenticationType.
+ ///
+ AuthenticationMode AuthenticationMode { get; set; }
+
+ ///
+ /// Additional information about the authentication type which is made available to the application.
+ ///
+ AuthenticationDescription Description { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.AspNet.Security/Infrastructure/AuthenticationHandler.cs b/src/Microsoft.AspNet.Security/Infrastructure/AuthenticationHandler.cs
index 57c1931f9..947b71617 100644
--- a/src/Microsoft.AspNet.Security/Infrastructure/AuthenticationHandler.cs
+++ b/src/Microsoft.AspNet.Security/Infrastructure/AuthenticationHandler.cs
@@ -33,7 +33,7 @@ public abstract class AuthenticationHandler : IAuthenticationHandler
private bool _applyResponseInitialized;
private object _applyResponseSyncLock;
- private AuthenticationOptions _baseOptions;
+ private IAuthenticationOptions _baseOptions;
protected IChallengeContext ChallengeContext { get; set; }
protected SignInIdentityContext SignInIdentityContext { get; set; }
@@ -53,14 +53,14 @@ protected HttpResponse Response
protected PathString RequestPathBase { get; private set; }
- internal AuthenticationOptions BaseOptions
+ internal IAuthenticationOptions BaseOptions
{
get { return _baseOptions; }
}
public IAuthenticationHandler PriorHandler { get; set; }
- protected async Task BaseInitializeAsync(AuthenticationOptions options, HttpContext context)
+ protected async Task BaseInitializeAsync(IAuthenticationOptions options, HttpContext context)
{
_baseOptions = options;
Context = context;
diff --git a/src/Microsoft.AspNet.Security/Infrastructure/AuthenticationHandler`1.cs b/src/Microsoft.AspNet.Security/Infrastructure/AuthenticationHandler`1.cs
index 7d8fb0726..0312afb4e 100644
--- a/src/Microsoft.AspNet.Security/Infrastructure/AuthenticationHandler`1.cs
+++ b/src/Microsoft.AspNet.Security/Infrastructure/AuthenticationHandler`1.cs
@@ -11,7 +11,7 @@ namespace Microsoft.AspNet.Security.Infrastructure
/// Base class for the per-request work performed by most authentication middleware.
///
/// Specifies which type for of AuthenticationOptions property
- public abstract class AuthenticationHandler : AuthenticationHandler where TOptions : AuthenticationOptions
+ public abstract class AuthenticationHandler : AuthenticationHandler where TOptions : IAuthenticationOptions
{
protected TOptions Options { get; private set; }
diff --git a/src/Microsoft.AspNet.Security/Infrastructure/AuthenticationMiddleware.cs b/src/Microsoft.AspNet.Security/Infrastructure/AuthenticationMiddleware.cs
index 8077b22d6..c0bd863ec 100644
--- a/src/Microsoft.AspNet.Security/Infrastructure/AuthenticationMiddleware.cs
+++ b/src/Microsoft.AspNet.Security/Infrastructure/AuthenticationMiddleware.cs
@@ -9,7 +9,7 @@
namespace Microsoft.AspNet.Security.Infrastructure
{
- public abstract class AuthenticationMiddleware where TOptions : AuthenticationOptions
+ public abstract class AuthenticationMiddleware where TOptions : IAuthenticationOptions
{
private readonly RequestDelegate _next;