| using
uthentic.Web.Security.HttpDigest;
using uthentic.Web.Security.HttpDigest.Events;
// for namespace abbreviations when later referencing
// the AuthenticationEventArgs and DigestHelper classes
// This is
the global.asax of your ASP.NET Web Application
// Note
that the validation here is simple
// But the concept quite powerful!
protected void HttpDigestModule_Authentication(object
source, AuthenticationEventArgs e)
{
if (e.Username.Equals("admin"))
{
e.UsernameAccepted("secret-password123");
// The valid password for User 'admin'
is 'secret-password123'
}
else if (e.Username.Equals("mickey"))
{
e.UsernameAccepted("mouse-password");
// The valid password for User 'mickey'
is 'mouse-password'
}
else
{
e.UsernameRejected();
// We do not know any other
users. Reject this one.
}
} |