public override OAuthState Handle(OAuthResult specification)
 {
     if (CanHandle(specification))
     {
         _oAuthWrapper.CreateOrUpdateAccount(specification.Provider, specification.ProviderUserId, HttpContext.Current.User.Identity.Name);
         return(OAuthState.OAuthCreated);
     }
     else
     {
         return(Successor.Handle(specification));
     }
 }
예제 #2
0
        public bool ConfirmClientRegistration(string username, string email, string provider, string providerUserId)
        {
            var user = _userRepository.GetUserByName(username);

            if (user != null)
            {
                return(false);
            }

            user = new User {
                Username = username, Email = email, UserKey = Guid.NewGuid()
            };
            _userRepository.Insert(user);
            _unitOfWork.Save();

            _oAuthWrapper.CreateOrUpdateAccount(provider, providerUserId, username);
            return(_oAuthWrapper.Login(provider, providerUserId));
        }