Created
March 8, 2013 16:54
-
-
Save jmarnold/5117936 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OurWindowsPrincipalHandler : IWindowsPrincipalHandler | |
{ | |
private readonly ITransaction _transaction; | |
public OurWindowsPrincipalHandler(ITransaction transaction) | |
{ | |
_transaction = transaction; | |
} | |
public bool Authenticated(IPrincipal principal) | |
{ | |
_transaction.WithRepository(repository => | |
{ | |
if (repository.All<User>().Any(x => x.UserName == principal.Identity.Name)) return; | |
repository.Update(new User { UserName = principal.Identity.Name }); | |
}); | |
return true; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ReplaceService<IWindowsPrincipalHandler, OurWindowsPrincipalHandler>(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment