/// <summary> /// Gets details of the authenticated user. /// </summary> /// <param name="principal"> /// The principal. /// </param> /// <returns> /// A populated instance of the User class. /// </returns> protected override User GetAuthenticatedUser(IPrincipal principal) { return User.CreateFromPrincipal(principal); }
/// <summary> /// Creates a User instance from the supplied IPrincipal. /// </summary> /// <param name="principal"> /// The principal. /// </param> /// <returns> /// A populated instance of the User class. /// </returns> public static User CreateFromPrincipal(IPrincipal principal) { return new User { FriendlyName = principal.Identity.Name, Name = principal.Identity.Name, Roles = System.Web.Security.Roles.GetRolesForUser(principal.Identity.Name) }; }