// Copyright (c) .NET Foundation. 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.Net.Http;
using Microsoft.AspNet.Http;
namespace Microsoft.AspNet.Authentication.Twitter
{
///
/// Options for the Twitter authentication middleware.
///
public class TwitterAuthenticationOptions : AuthenticationOptions
{
///
/// Initializes a new instance of the class.
///
public TwitterAuthenticationOptions()
{
AuthenticationScheme = TwitterAuthenticationDefaults.AuthenticationScheme;
Caption = AuthenticationScheme;
CallbackPath = new PathString("/signin-twitter");
BackchannelTimeout = TimeSpan.FromSeconds(60);
}
///
/// Gets or sets the consumer key used to communicate with Twitter.
///
/// The consumer key used to communicate with Twitter.
public string ConsumerKey { get; set; }
///
/// Gets or sets the consumer secret used to sign requests to Twitter.
///
/// The consumer secret used to sign requests to Twitter.
public string ConsumerSecret { get; set; }
///
/// Gets or sets timeout value in milliseconds for back channel communications with Twitter.
///
///
/// The back channel timeout.
///
public TimeSpan BackchannelTimeout { get; set; }
///
/// The HttpMessageHandler used to communicate with Twitter.
/// This cannot be set at the same time as BackchannelCertificateValidator unless the value
/// can be downcast to a WebRequestHandler.
///
public HttpMessageHandler BackchannelHttpHandler { get; set; }
///
/// 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; }
}
///
/// 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-twitter".
///
public PathString CallbackPath { get; set; }
///
/// Gets or sets the authentication scheme corresponding to the middleware
/// responsible of persisting user's identity after a successful authentication.
/// This value typically corresponds to a cookie middleware registered in the Startup class.
/// When omitted, is used as a fallback value.
///
public string SignInScheme { get; set; }
///
/// Gets or sets the type used to secure data handled by the middleware.
///
public ISecureDataFormat StateDataFormat { get; set; }
///
/// Gets or sets the used to handle authentication events.
///
public ITwitterAuthenticationEvents Events { get; set; }
///
/// Defines whether access tokens should be stored in the
/// after a successful authentication.
/// This property is set to false by default to reduce
/// the size of the final authentication cookie.
///
public bool SaveTokensAsClaims { get; set; }
}
}