using System;
using System.Collections.Generic;
using OwinFramework.InterfacesV1.Middleware;
namespace OwinFramework.InterfacesV1.Facilities
{
///
/// When users create shared secrets that provide access to their account, they
/// need to be able to go back later and delete or deactivate these secrets, hence
/// these have to be given names.
///
public interface ISharedSecret
{
///
/// The name of this shared secret
///
string Name { get; }
///
/// The secret that can be shared to provide access to the system
///
string Secret { get; }
///
/// Contains the purposes that this shared secret can be used for
///
IList Purposes { get; }
}
///
/// Defines a facility that stores shared secrets that third-party systems
/// can use when identifying themselves to your APIs
///
public interface ISharedSecretStore
{
///
/// Returns true if this identity store can work with shared secrets
///
bool SupportsSharedSecrets { get; }
///
/// Creates a shared secret that can be used to authenticate as an identity
///
/// The identity to associate
/// When users create shared keys to give access to their account they
/// can give a name to each one so that they can manage them later
/// Optional list of purposes to limit the scope of this login
/// A short unique url friendly string that can be shared with a third party to give them
/// the ability to authenticate as this identity
string AddSharedSecret(string identity, string name, IList purposes);
///
/// Removes a shared secret from an identity preventing login with this shared secret in future
///
bool DeleteSharedSecret(string sharedSecret);
///
/// Returns a list of all the shared secrets associated with an identity
///
IList GetAllSharedSecrets(string identity);
///
/// Provides shared secret authentication. The shared secret should be send securely
/// to the other party, and they must logon through a secure connection.
///
/// A secret key that was provided to a 3rd party
IAuthenticationResult AuthenticateWithSharedSecret(string sharedSecret);
}
}