ln.http/AuthenticationProvider.cs

39 lines
977 B
C#

// /**
// * File: AuthenticationProvider.cs
// * Author: haraldwolff
// *
// * This file and it's content is copyrighted by the Author and / or copyright holder.
// * Any use wihtout proper permission is illegal and may lead to legal actions.
// *
// *
// **/
using System;
using System.Collections.Generic;
namespace ln.http
{
public abstract class AuthenticationProvider
{
public AuthenticationProvider()
{
}
public abstract IEnumerable<HttpUser> EnumerateUsers();
public abstract HttpUser Authenticate(HttpRequest httpRequest);
public virtual HttpUser GetHttpUser(String authenticationName)
{
foreach (HttpUser httpUser in EnumerateUsers())
{
if (httpUser.AuthenticationName.Equals(authenticationName))
{
return httpUser;
}
}
throw new KeyNotFoundException();
}
}
}