//-----------------------------------------------------------------------
//
// Copyright (c) Andrew Arnott. All rights reserved.
//
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.OAuth {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Validation;
///
/// Describes an OAuth 1.0 service provider.
///
public class ServiceProviderDescription {
///
/// Initializes a new instance of the class.
///
public ServiceProviderDescription() {
this.TemporaryCredentialsRequestEndpointMethod = HttpMethod.Post;
this.TokenRequestEndpointMethod = HttpMethod.Post;
}
///
/// Initializes a new instance of the class.
///
/// The temporary credentials request endpoint.
/// The resource owner authorization endpoint.
/// The token request endpoint.
public ServiceProviderDescription(
string temporaryCredentialsRequestEndpoint, string resourceOwnerAuthorizationEndpoint, string tokenRequestEndpoint)
: this() {
if (temporaryCredentialsRequestEndpoint != null) {
this.TemporaryCredentialsRequestEndpoint = new Uri(temporaryCredentialsRequestEndpoint, UriKind.Absolute);
}
if (resourceOwnerAuthorizationEndpoint != null) {
this.ResourceOwnerAuthorizationEndpoint = new Uri(resourceOwnerAuthorizationEndpoint, UriKind.Absolute);
}
if (tokenRequestEndpoint != null) {
this.TokenRequestEndpoint = new Uri(tokenRequestEndpoint, UriKind.Absolute);
}
}
///
/// Gets or sets the temporary credentials request endpoint.
///
///
/// The temporary credentials request endpoint.
///
public Uri TemporaryCredentialsRequestEndpoint { get; set; }
///
/// Gets or sets the HTTP method to use with the temporary credentials request endpoint.
///
public HttpMethod TemporaryCredentialsRequestEndpointMethod { get; set; }
///
/// Gets or sets the resource owner authorization endpoint.
///
///
/// The resource owner authorization endpoint.
/// May be null for 2-legged OAuth.
///
public Uri ResourceOwnerAuthorizationEndpoint { get; set; }
///
/// Gets or sets the token request endpoint.
///
///
/// The token request endpoint.
///
public Uri TokenRequestEndpoint { get; set; }
///
/// Gets or sets the HTTP method to use with the token request endpoint.
///
public HttpMethod TokenRequestEndpointMethod { get; set; }
}
}