Example #1
0
 /// <summary>
 /// Refreshes the authentication cookie.
 /// </summary>
 /// <param name="email">The email.</param>
 public void RefreshAuthenticationCookie(WMUserIdentity identity)
 {
     AuthenticationCookieManager.RefreshAuthenticationCookie <WMUserIdentity>(
         _WorkmateMembershipProvider.AuthenticationTimeoutInSeconds
         , _WorkmateMembershipProvider.PersistentAuthenticationTimeoutInSeconds
         , identity);
 }
Example #2
0
 static WMUserPrincipal()
 {
     _AnonymousInstance = new WMUserPrincipal(
         WMUserIdentity.Create(UserBasic.GetAnonymousUserInstance()
                               , false
                               , DateTime.MinValue
                               , DateTime.MinValue));
 }
Example #3
0
        /// <summary>
        /// Updates the authentication cookie.
        /// </summary>
        /// <param name="userBasic">The user basic.</param>
        public void UpdateAuthenticationCookie(IUserBasic userBasic)
        {
            WMUserIdentity identity = WMUserIdentity.Create(userBasic, true, DateTime.UtcNow, DateTime.UtcNow);

            AuthenticationCookieManager.UpdateAuthenticationCookie <WMUserIdentity>(
                _WorkmateMembershipProvider.AuthenticationTimeoutInSeconds
                , _WorkmateMembershipProvider.PersistentAuthenticationTimeoutInSeconds
                , identity);
        }
Example #4
0
        /// <summary>
        /// Writes the authentication cookie.
        /// </summary>
        /// <param name="userBasic">The user basic.</param>
        /// <param name="rememberMe">if set to <c>true</c> [remember me].</param>
        public void WriteAuthenticationCookie(IUserBasic userBasic, bool rememberMe)
        {
            WMUserIdentity identity = WMUserIdentity.Create(userBasic, true, DateTime.UtcNow, DateTime.UtcNow);

            AuthenticationCookieManager.WriteAuthenticationCookie <WMUserIdentity>(
                userBasic.UserName
                , _WorkmateMembershipProvider.AuthenticationTimeoutInSeconds
                , _WorkmateMembershipProvider.PersistentAuthenticationTimeoutInSeconds
                , identity
                , rememberMe);
        }
Example #5
0
        public static WMUserIdentity Create(IUserBasic userBasic, bool updateLastActivityDateUtc, DateTime lastActivityUpdate, DateTime lastRecordCheckUtc)
        {
            WMUserIdentity identity = new WMUserIdentity();

            identity.UserId              = userBasic.UserId;
            identity.Email               = userBasic.Email;
            identity.AccountStatus       = userBasic.AccountStatus;
            identity.DateCreatedUtc      = userBasic.DateCreatedUtc;
            identity.LastActivityDateUtc = updateLastActivityDateUtc ? DateTime.UtcNow
                                                         : userBasic.LastActivityDateUtc;
            identity.LastActivityUpdate = lastActivityUpdate;
            identity.UserRoles          = userBasic.UserRoles;
            identity.LastRecordCheckUtc = lastRecordCheckUtc;
            identity.LastLoginDateUtc   = userBasic.LastLoginDateUtc;
            identity.ProfileImageId     = userBasic.ProfileImageId;
            identity.TimeZoneInfoId     = userBasic.TimeZoneInfoId;

            identity.IsAnonymous = userBasic.IsAnonymous;

            return(identity);
        }
Example #6
0
        public WMUserIdentity(FormsIdentity identity)
        {
            WMUserIdentity cookie = AuthenticationCookieManager.GetEmbeddedDataFromAuthenticationCookie <WMUserIdentity>();

            this.UserId              = cookie.UserId;
            this.Email               = cookie.Email;
            this.AccountStatus       = cookie.AccountStatus;
            this.DateCreatedUtc      = cookie.DateCreatedUtc;
            this.LastActivityDateUtc = cookie.LastActivityDateUtc;
            this.LastActivityUpdate  = cookie.LastActivityUpdate;
            this.LastLoginDateUtc    = cookie.LastLoginDateUtc;
            this.LastRecordCheckUtc  = cookie.LastRecordCheckUtc;
            this.ProfileImageId      = cookie.ProfileImageId;
            this.TimeZoneInfoId      = cookie.TimeZoneInfoId;

            this.UserRoles = cookie.UserRoles;

            this.Name               = identity.Name;
            this.IsAuthenticated    = identity.IsAuthenticated;
            this.AuthenticationType = identity.AuthenticationType;
            this.UserName           = identity.Name;

            this.IsAnonymous = false;
        }
Example #7
0
 private WMUserPrincipal(WMUserIdentity userIdentity)
 {
     this._WMUserIdentity = userIdentity;
 }
Example #8
0
 public WMUserPrincipal(FormsIdentity identity)
 {
     _WMUserIdentity = new WMUserIdentity(identity);
 }