//-----------------------------------------------------------------------
//
// Copyright (c) Outercurve Foundation. All rights reserved.
//
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.OAuth2 {
using System;
using System.Collections.Generic;
using DotNetOpenAuth.Messaging;
using Validation;
///
/// A description of a client from an Authorization Server's point of view.
///
public interface IClientDescription {
///
/// Gets the callback to use when an individual authorization request
/// does not include an explicit callback URI.
///
/// An absolute URL; or null if none is registered.
Uri DefaultCallback { get; }
///
/// Gets the type of the client.
///
ClientType ClientType { get; }
///
/// Gets a value indicating whether a non-empty secret is registered for this client.
///
bool HasNonEmptySecret { get; }
///
/// Determines whether a callback URI included in a client's authorization request
/// is among those allowed callbacks for the registered client.
///
/// The absolute URI the client has requested the authorization result be received at. Never null.
///
/// true if the callback URL is allowable for this client; otherwise, false.
///
///
///
/// At the point this method is invoked, the identity of the client has not
/// been confirmed. To avoid open redirector attacks, the alleged client's identity
/// is used to lookup a list of allowable callback URLs to make sure that the callback URL
/// the actual client is requesting is one of the expected ones.
///
///
/// From OAuth 2.0 section 2.1:
/// The authorization server SHOULD require the client to pre-register
/// their redirection URI or at least certain components such as the
/// scheme, host, port and path. If a redirection URI was registered,
/// the authorization server MUST compare any redirection URI received at
/// the authorization endpoint with the registered URI.
///
///
bool IsCallbackAllowed(Uri callback);
///
/// Checks whether the specified client secret is correct.
///
/// The secret obtained from the client.
/// true if the secret matches the one in the authorization server's record for the client; false otherwise.
///
/// All string equality checks, whether checking secrets or their hashes,
/// should be done using to mitigate timing attacks.
///
bool IsValidClientSecret(string secret);
}
}