Created
January 19, 2010 14:41
-
-
Save Buthrakaur/280965 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 WcfApplicationContext: IApplicationContext | |
{ | |
private readonly IRepository<User> userRepository; | |
public WcfApplicationContext(IRepository<User> userRepository) | |
{ | |
this.userRepository = userRepository; | |
} | |
public User CurrentUser | |
{ | |
get | |
{ | |
var identity = OperationContext.Current.ServiceSecurityContext.PrimaryIdentity; | |
if (!identity.IsAuthenticated || string.IsNullOrEmpty(identity.Name)) | |
{ | |
return null; | |
} | |
return userRepository.Get(x => x.UserName == identity.Name); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment