Exemplo n.º 1
0
        /// <summary>
        /// ConfirmUserSession requie cal method CheckPassword before.
        /// </summary>
        /// <returns></returns>
        public string ConfirmUserSession(IServiceContext serviceContext, User user)
        {
            var token = Guid.NewGuid().ToString();

            UserAuthenticationCache.PutUser(serviceContext, user, token);
            return(token);
        }
Exemplo n.º 2
0
 public void TryAuthorise()
 {
     if (userToken != null && userToken.Trim() != String.Empty)
     {
         var user = UserAuthenticationCache.GetUser(this, userToken);
         if (user != null)
         {
             //TODO: Create converter.
             var autorisedUser = new UserSession()
             {
                 UserId   = user.UserId,
                 UserName = user.Login,
             };
             this._user = autorisedUser;
         }
     }
 }