// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Security;
namespace Microsoft.AspNet.Security.OAuth
{
///
/// Configuration options for .
///
public class OAuthAuthenticationOptions : AuthenticationOptions
{
///
/// Initializes a new .
///
public OAuthAuthenticationOptions()
{
AuthenticationMode = AuthenticationMode.Passive;
Scope = new List();
BackchannelTimeout = TimeSpan.FromSeconds(60);
}
///
/// Gets or sets the provider-assigned client id.
///
public string ClientId { get; set; }
///
/// Gets or sets the provider-assigned client secret.
///
public string ClientSecret { get; set; }
///
/// Gets or sets the URI where the client will be redirected to authenticate.
///
public string AuthorizationEndpoint { get; set; }
///
/// Gets or sets the URI the middleware will access to exchange the OAuth token.
///
public string TokenEndpoint { get; set; }
///
/// Gets or sets the URI the middleware will access to obtain the user information.
/// This value is not used in the default implementation, it is for use in custom implementations of
/// IOAuthAuthenticationNotifications.GetUserInformationAsync or OAuthAuthenticationHandler.GetUserInformationAsync.
///
public string UserInformationEndpoint { get; set; }
#if ASPNET50
///
/// Gets or sets the a pinned certificate validator to use to validate the endpoints used
/// in back channel communications belong to the auth provider.
///
///
/// 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.
public ICertificateValidator BackchannelCertificateValidator { get; set; }
#endif
///
/// Get or sets the text that the user can display on a sign in user interface.
///
public string Caption
{
get { return Description.Caption; }
set { Description.Caption = value; }
}
///
/// Gets or sets timeout value in milliseconds for back channel communications with the auth provider.
///
///
/// The back channel timeout.
///
public TimeSpan BackchannelTimeout { get; set; }
///
/// The HttpMessageHandler used to communicate with the auth provider.
/// This cannot be set at the same time as BackchannelCertificateValidator unless the value
/// can be downcast to a WebRequestHandler.
///
public HttpMessageHandler BackchannelHttpHandler { get; set; }
///
/// A list of permissions to request.
///
public IList Scope { get; private 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.
///
public PathString CallbackPath { get; set; }
///
/// Gets or sets the name of another authentication middleware which will be responsible for actually issuing a user .
///
public string SignInAsAuthenticationType { get; set; }
///
/// Gets or sets the type used to secure data handled by the middleware.
///
public ISecureDataFormat StateDataFormat { get; set; }
}
}