/// <summary>
 /// External: The user has logged in on some other site
 /// Either we are supplied a new identity, in which case we add it to our user store
 /// Or we are supplied an existing identity, in which case we return the claims for this user
 /// </summary>
 /// <param name="identity"></param>
 /// <param name="signInData"></param>
 /// <returns></returns>
 public async Task<AuthenticationResult> AuthenticateExternalAsync(ExternalIdentity identity, SignInData signInData)
 {
     //There must be an identity for this to make sense
     if (identity == null)
     {
         throw new ArgumentNullException("identity");
     }
     //The user manager tries to find a matching user
     var user = await manager.FindAsync(new Microsoft.AspNet.Identity.UserLoginInfo(identity.Provider, identity.ProviderId));
     if (user == null)
     {
         //Create a new account
         return await ProcessNewExternalAccountAsync(identity.Provider, identity.ProviderId, identity.Claims);
     }
     else
     {
         return await ProcessExistingExternalAccountAsync(user.Id, identity.Provider, identity.ProviderId, identity.Claims);
     }
 }
        public AuthenticationResult(string redirectPath, ExternalIdentity externalId)
        {
            if (string.IsNullOrWhiteSpace(redirectPath))
            {
                throw new ArgumentNullException(nameof(redirectPath));
            }

            if (!redirectPath.StartsWith("~/") && !redirectPath.StartsWith("/"))
            {
                throw new ArgumentException($"{nameof(redirectPath)} must start with / or ~/");
            }

            if (externalId == null)
            {
                throw new ArgumentNullException(nameof(externalId));
            }

            this.PartialSignInRedirectPath = redirectPath;

            var id = new ClaimsIdentity(externalId.Claims, AuthenticationTypes.PartialSignInAuthenticationType);

            this.User = new ClaimsPrincipal(id);
        }
        public AuthenticationResult(string redirectPath, ExternalIdentity externalId)
        {
            if (string.IsNullOrWhiteSpace(redirectPath))
            {
                throw new ArgumentNullException(nameof(redirectPath));
            }

            if (!redirectPath.StartsWith("~/") && !redirectPath.StartsWith("/"))
            {
                throw new ArgumentException($"{nameof(redirectPath)} must start with / or ~/");
            }

            if (externalId == null)
            {
                throw new ArgumentNullException(nameof(externalId));
            }

            this.PartialSignInRedirectPath = redirectPath;

            var id = new ClaimsIdentity(externalId.Claims, AuthenticationTypes.PartialSignInAuthenticationType);

            this.User = new ClaimsPrincipal(id);
        }
 public Task<AuthenticationResult> AuthenticateExternalAsync(ExternalIdentity identity, SignInData signInData)
 {
     throw new NotImplementedException();
 }