コード例 #1
0
        /// <summary>
        /// Gets the user for the specified principal.
        /// </summary>
        /// <remarks>
        /// The user is populated with data from <paramref name="principal"/>,
        /// <see cref="Roles"/>, and <see cref="ProfileBase"/>.
        /// </remarks>
        /// <param name="principal">The principal to get the user for</param>
        /// <returns>The user for the specified principal</returns>
        private T GetUserImpl(IPrincipal principal)
        {
            T user = this.CreateUser();

            if (user == null)
            {
                throw new InvalidOperationException(
                          string.Format(
                              CultureInfo.InvariantCulture,
                              Resources.ApplicationServices_CreateUserCannotBeNull,
                              this.GetType()));
            }

            user.Name  = principal.Identity.Name;
            user.Roles = AuthenticationBase <T> .GetRoles(user.Name);

            AuthenticationBase <T> .GetProfile(user);

            return(user);
        }