コード例 #1
0
 private void CreateAndAssignNewSocialLoginForApplicationUser(
     Claim identifier,
     AuthenticationTypeProvider authenticationTypeProvider,
     long newUserId)
 {
     this.entityRepository.CreateNewSocialLogin(identifier.Value, authenticationTypeProvider, newUserId);
 }
コード例 #2
0
        private void CreateAndAssignNewSocialLoginForApplicationUser(Claim identifier,
                                                                     AuthenticationTypeProvider authenticationTypeProvider,
                                                                     User newUser)
        {
            var socialLogin = new SocialLogin(identifier.Value, authenticationTypeProvider, newUser.Id);

            this.socialLoginRepository.SaveToDatabase(socialLogin);
        }
コード例 #3
0
 public bool UserIsRegistered(AuthenticationTypeProvider authenticationTypeProvider, string userId)
 {
     var exists = this.itanDatabaseContext
                      .SocialLogins
                      .Where(l => l.Provider == authenticationTypeProvider)
                      .Where(l => l.SocialId == userId)
                      .Any();
     return exists;
 }
コード例 #4
0
        public AuthenticationTypeProvider GetCurrentUserLoginProvider(ClaimsIdentity identity)
        {
            var issuer = identity.Claims.First(claim => !string.IsNullOrWhiteSpace(claim.Issuer))
                         .Issuer;
            AuthenticationTypeProvider enumResult = AuthenticationTypeProvider.Unknown;

            Enum.TryParse(issuer, true, out enumResult);
            return(enumResult);
        }
コード例 #5
0
 public long GetUserId(string currentUserSocialLoginId, AuthenticationTypeProvider currentUserLoginProvider)
 {
     var socialLogin =
         this.itanDatabaseContext.SocialLogins
             .Where(login => login.SocialId == currentUserSocialLoginId)
             .Where(login => login.Provider == currentUserLoginProvider)
             .Select(login => login.UserId)
             .Single();
     return socialLogin;
 }
コード例 #6
0
        public SocialLogin FindSocialLogin(string socialLoginId, AuthenticationTypeProvider provider)
        {
            var socialLogin = this.itanDatabaseContext
                              .SocialLogins
                              .Where(login => login.SocialId == socialLoginId)
                              .Where(login => login.Provider == provider)
                              .SingleOrDefault();

            return(socialLogin);
        }
コード例 #7
0
        public SocialLogin FindSocialLogin(string socialLoginId, AuthenticationTypeProvider provider)
        {
            var socialLogin =
                this.itanDatabaseContext
                    .SocialLogins
                    .Where(login => login.SocialId == socialLoginId)
                    .Where(login => login.Provider == provider)
                    .SingleOrDefault();

            return socialLogin;
        }
コード例 #8
0
        public ActionResult SocialLogin(AuthenticationTypeProvider id)
        {
            var authenticationProperties = new AuthenticationProperties
            {
                RedirectUri = "/Login/Success",
                IsPersistent = true
            };

            this.HttpContext.GetOwinContext().Authentication.Challenge(authenticationProperties, id.ToString());
            return new HttpUnauthorizedResult();
        }
コード例 #9
0
        public ActionResult SocialLogin(AuthenticationTypeProvider id)
        {
            var authenticationProperties = new AuthenticationProperties
            {
                RedirectUri  = "/Login/Success",
                IsPersistent = true
            };

            this.HttpContext.GetOwinContext().Authentication.Challenge(authenticationProperties, id.ToString());
            return(new HttpUnauthorizedResult());
        }
コード例 #10
0
 public void CreateNewSociaLogin(string identifierValue, AuthenticationTypeProvider authenticationTypeProvider, long newUserId)
 {
     var socialLogin = new SocialLogin(identifierValue, authenticationTypeProvider, newUserId);
     this.itanDatabaseContext.SocialLogins.Add(socialLogin);
     this.itanDatabaseContext.SaveChanges();
 }
コード例 #11
0
 public SocialLogin(string identifier, AuthenticationTypeProvider authenticationTypeProvider, long userId)
 {
     this.SocialId = identifier;
     this.Provider = authenticationTypeProvider;
     this.UserId   = userId;
 }
コード例 #12
0
 private void CreateAndAssignNewSocialLoginForApplicationUser(Claim identifier,
                                                              AuthenticationTypeProvider authenticationTypeProvider,
                                                              long newUserId)
 {
     this.socialLoginRepository.CreateNewSociaLogin(identifier.Value, authenticationTypeProvider, newUserId);
 }
コード例 #13
0
 public SocialLogin(string identifier, AuthenticationTypeProvider authenticationTypeProvider, long userId)
 {
     this.SocialId = identifier;
     this.Provider = authenticationTypeProvider;
     this.UserId = userId;
 }