コード例 #1
0
        public void TestNoProfile()
        {
            var result = _linkedInAuthenticationCommand.AuthenticateUser(LinkedInId);

            Assert.AreEqual(AuthenticationStatus.Failed, result.Status);
            Assert.IsNull(result.User);
        }
コード例 #2
0
        private bool LogIn(string linkedInProfileId)
        {
            var result = _linkedInAuthenticationCommand.AuthenticateUser(linkedInProfileId);

            switch (result.Status)
            {
            case AuthenticationStatus.Authenticated:
                _authenticationManager.LogIn(HttpContext, result.User, AuthenticationStatus.Authenticated);
                return(true);

            case AuthenticationStatus.Deactivated:

                // If they are logging in with their LinkedIn credentials assume they are activated.

                _userAccountsCommand.ActivateUserAccount(result.User, result.User.Id);
                _authenticationManager.LogIn(HttpContext, result.User, AuthenticationStatus.Authenticated);
                return(true);

            default:
                return(false);
            }
        }