Example #1
0
		/// <summary>
		/// Initializes a new instance of the <see cref="ClientBase" /> class.
		/// </summary>
		/// <param name="authorizationServer">The token issuer.</param>
		/// <param name="clientIdentifier">The client identifier.</param>
		/// <param name="clientCredentialApplicator">The tool to use to apply client credentials to authenticated requests to the Authorization Server.
		/// May be <c>null</c> for clients with no secret or other means of authentication.</param>
		/// <param name="hostFactories">The host factories.</param>
		protected ClientBase(AuthorizationServerDescription authorizationServer, string clientIdentifier = null, ClientCredentialApplicator clientCredentialApplicator = null, IHostFactories hostFactories = null) {
			Requires.NotNull(authorizationServer, "authorizationServer");
			this.AuthorizationServer = authorizationServer;
			this.Channel = new OAuth2ClientChannel(hostFactories);
			this.ClientIdentifier = clientIdentifier;
			this.ClientCredentialApplicator = clientCredentialApplicator;
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="WebServerClient" /> class.
		/// </summary>
		/// <param name="authorizationServer">The authorization server.</param>
		/// <param name="clientIdentifier">The client identifier.</param>
		/// <param name="clientCredentialApplicator">The tool to use to apply client credentials to authenticated requests to the Authorization Server.
		/// May be <c>null</c> for clients with no secret or other means of authentication.</param>
		/// <param name="hostFactories">The host factories.</param>
		public WebServerClient(AuthorizationServerDescription authorizationServer, string clientIdentifier, ClientCredentialApplicator clientCredentialApplicator, IHostFactories hostFactories = null)
			: base(authorizationServer, clientIdentifier, clientCredentialApplicator, hostFactories) {
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="UserAgentClient"/> class.
		/// </summary>
		/// <param name="authorizationEndpoint">The authorization endpoint.</param>
		/// <param name="tokenEndpoint">The token endpoint.</param>
		/// <param name="clientIdentifier">The client identifier.</param>
		/// <param name="clientCredentialApplicator">
		/// The tool to use to apply client credentials to authenticated requests to the Authorization Server.  
		/// May be <c>null</c> for clients with no secret or other means of authentication.
		/// </param>
		public UserAgentClient(Uri authorizationEndpoint, Uri tokenEndpoint, string clientIdentifier, ClientCredentialApplicator clientCredentialApplicator)
			: this(new AuthorizationServerDescription { AuthorizationEndpoint = authorizationEndpoint, TokenEndpoint = tokenEndpoint }, clientIdentifier, clientCredentialApplicator) {
			Requires.NotNull(authorizationEndpoint, "authorizationEndpoint");
			Requires.NotNull(tokenEndpoint, "tokenEndpoint");
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="UserAgentClient"/> class.
		/// </summary>
		/// <param name="authorizationServer">The token issuer.</param>
		/// <param name="clientIdentifier">The client identifier.</param>
		/// <param name="clientCredentialApplicator">
		/// The tool to use to apply client credentials to authenticated requests to the Authorization Server.  
		/// May be <c>null</c> for clients with no secret or other means of authentication.
		/// </param>
		public UserAgentClient(AuthorizationServerDescription authorizationServer, string clientIdentifier, ClientCredentialApplicator clientCredentialApplicator)
			: base(authorizationServer, clientIdentifier, clientCredentialApplicator) {
		}
 /// <summary>
 /// Applies the default client authentication mechanism given a client secret.
 /// </summary>
 /// <param name="secret">The client secret.  May be <c>null</c></param>
 /// <returns>The client credential applicator.</returns>
 protected static ClientCredentialApplicator DefaultSecretApplicator(string secret)
 {
     return(secret == null?ClientCredentialApplicator.NoSecret() : ClientCredentialApplicator.NetworkCredential(secret));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ClientBase"/> class.
 /// </summary>
 /// <param name="authorizationServer">The token issuer.</param>
 /// <param name="clientIdentifier">The client identifier.</param>
 /// <param name="clientCredentialApplicator">
 /// The tool to use to apply client credentials to authenticated requests to the Authorization Server.
 /// May be <c>null</c> for clients with no secret or other means of authentication.
 /// </param>
 protected ClientBase(AuthorizationServerDescription authorizationServer, string clientIdentifier = null, ClientCredentialApplicator clientCredentialApplicator = null)
 {
     Requires.NotNull(authorizationServer, "authorizationServer");
     this.AuthorizationServer        = authorizationServer;
     this.Channel                    = new OAuth2ClientChannel();
     this.ClientIdentifier           = clientIdentifier;
     this.ClientCredentialApplicator = clientCredentialApplicator;
 }
Example #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UserAgentClient" /> class.
 /// </summary>
 /// <param name="authorizationServer">The token issuer.</param>
 /// <param name="clientIdentifier">The client identifier.</param>
 /// <param name="clientCredentialApplicator">The tool to use to apply client credentials to authenticated requests to the Authorization Server.
 /// May be <c>null</c> for clients with no secret or other means of authentication.</param>
 /// <param name="hostFactories">The host factories.</param>
 public UserAgentClient(AuthorizationServerDescription authorizationServer, string clientIdentifier, ClientCredentialApplicator clientCredentialApplicator, IHostFactories hostFactories = null)
     : base(authorizationServer, clientIdentifier, clientCredentialApplicator, hostFactories)
 {
 }
Example #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UserAgentClient" /> class.
 /// </summary>
 /// <param name="authorizationEndpoint">The authorization endpoint.</param>
 /// <param name="tokenEndpoint">The token endpoint.</param>
 /// <param name="clientIdentifier">The client identifier.</param>
 /// <param name="clientCredentialApplicator">The tool to use to apply client credentials to authenticated requests to the Authorization Server.
 /// May be <c>null</c> for clients with no secret or other means of authentication.</param>
 /// <param name="hostFactories">The host factories.</param>
 public UserAgentClient(Uri authorizationEndpoint, Uri tokenEndpoint, string clientIdentifier, ClientCredentialApplicator clientCredentialApplicator, IHostFactories hostFactories = null)
     : this(new AuthorizationServerDescription {
     AuthorizationEndpoint = authorizationEndpoint, TokenEndpoint = tokenEndpoint
 }, clientIdentifier, clientCredentialApplicator, hostFactories)
 {
     Requires.NotNull(authorizationEndpoint, "authorizationEndpoint");
     Requires.NotNull(tokenEndpoint, "tokenEndpoint");
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UserAgentClient"/> class.
 /// </summary>
 /// <param name="authorizationServer">The token issuer.</param>
 /// <param name="clientIdentifier">The client identifier.</param>
 /// <param name="clientCredentialApplicator">
 /// The tool to use to apply client credentials to authenticated requests to the Authorization Server.
 /// May be <c>null</c> for clients with no secret or other means of authentication.
 /// </param>
 public UserAgentClient(AuthorizationServerDescription authorizationServer, string clientIdentifier, ClientCredentialApplicator clientCredentialApplicator)
     : base(authorizationServer, clientIdentifier, clientCredentialApplicator)
 {
 }