//-----------------------------------------------------------------------
//
// Copyright (c) Andrew Arnott. All rights reserved.
//
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.OAuth2.ChannelElements {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using DotNetOpenAuth.OAuth2.Messages;
///
/// Reads client authentication information from the message payload itself (POST entity as a URI-encoded parameter).
///
public class ClientCredentialMessagePartReader : ClientAuthenticationModuleBase {
///
/// The authorization server host.
///
private readonly IAuthorizationServerHost authorizationServerHost;
///
/// Initializes a new instance of the class.
///
/// The authorization server host.
public ClientCredentialMessagePartReader(IAuthorizationServerHost authorizationServerHost) {
Requires.NotNull(authorizationServerHost, "authorizationServerHost");
this.authorizationServerHost = authorizationServerHost;
}
///
/// Attempts to extract client identification/authentication information from a message.
///
/// The incoming message.
/// Receives the client identifier, if one was found.
/// The level of the extracted client information.
public override ClientAuthenticationResult TryAuthenticateClient(AuthenticatedClientRequestBase requestMessage, out string clientIdentifier) {
Requires.NotNull(requestMessage, "requestMessage");
clientIdentifier = requestMessage.ClientIdentifier;
return TryAuthenticateClient(this.authorizationServerHost, requestMessage.ClientIdentifier, requestMessage.ClientSecret);
}
}
}