Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

How add multiple user access

$
0
0

Dear all, 

I have two api controller and I require a little help in how can I get the following code, to allow clients to enter in any username/password and the system will direct them to correct api controller. 

public class Login: IProvidePrincipal
{
    private const string Username = "#####";
    private const string Password = "####";
    public IPrincipal CreatePrincipal(string username, string password)
    {
        if (username != Username || password != Password)
        {
            return null;
        }
        var identity = new GenericIdentity(Username);
        IPrincipal principal = new GenericPrincipal(identity, new[] { "admin" });
        return principal;
    }
}

any help or advice would be most welcome.
Many thanks


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>