Use the specified identity provider to establish an authenticated
user.
772144
public static function getFromIdentityProvider(Provider $identityProvider)
    {
        // Have the identity provider authenticate the current identity.
        $identityProvider->authenticate();
        // The identity is valid according to the provider, so authentication is
        // passed.
        $userId = $identityProvider->getUserId();
        // Check for authorisation.
        try {
            Logger::get()->debug(sprintf(
                'Checking OpenID user %s...',
                $userId
            ));
            $user = Users::getInstance()->findEntity($userId);
            // The user is valid according to our records. Keep it in the session.
            $user->authenticate($identityProvider);
        } catch (NotFoundException $exception) {
            Logger::get()->warning(sprintf(
                'OpenID user %s is not known.',
                $userId
            ));
            throw new NotAuthorisedException(
                'OpenID user is not authorised.'
            );
        }

        return $user;
    }
864551
function Client(identity) {
  if (!(this instanceof Client)) {
    return new Client(identity);
  }

  assert(identity instanceof Identity, 'Invalid identity supplied');

  this._identity = identity;
  this._podhost = utils.getPodHostFromUserID(this._identity.userID);
  this._baseUrl = 'https://' + this._podhost;
  this._pubkey = this._identity._publicKeyArmored;
}
1255206
def handle_new_user(self, provider, access, info):
        ""
        user = self.get_or_create_user(provider, access, info)
        access.user = user
        AccountAccess.objects.filter(pk=access.pk).update(user=user)
        user = authenticate(provider=access.provider, identifier=access.identifier)
        login(self.request, user)
        return redirect(self.get_login_redirect(provider, user, access, True))
639979
function Identity(userID, passphrase, keyPair) {
  if (!(this instanceof Identity)) {
    return new Identity(userID, passphrase, keyPair);
  }

  assert(typeof userID === 'string', 'Invalid userID supplied');
  assert(typeof passphrase === 'string', 'Invalid passphrase supplied');

  this._publicKeyArmored = keyPair.publicKey.toString();
  this._privateKeyArmored = keyPair.privateKey.toString();

  this.userID = userID;
  this.publicKey = pgp.key.readArmored(this._publicKeyArmored).keys[0];
  this.privateKey = pgp.key.readArmored(this._privateKeyArmored).keys[0];

  assert(this.privateKey.decrypt(passphrase), 'Failed to decrypt private key');
}
663072
function (context, authenticationRequest, callback) {
            //
            var authProvider = this.getAuthenticationProviderForRequest(authenticationRequest);

            if (authProvider) {
                flow()
                    .seq("authentication", function (cb) {
                        // authenticate
                        authProvider.authenticate(authenticationRequest, cb);
                    })
                    .seq(function (cb) {
                        // init authentication
                        this.vars.authentication.init(cb);
                    })
                    .exec(function (err, results) {
                        var authentication = results.authentication;
                        if (!err && authentication) {
                            context.user.addAuthentication(authentication);
                        }
                        // return authentication with user id
                        callback(err, authentication);
                    })
            } else {
                callback(AuthenticationError.NO_PROVIDER_FOUND, null);
            }
        }
477045
def authenticateUser(self, login, user, properties):
    
    self.send_authenticateUser(login, user, properties)
    return self.recv_authenticateUser()
1284800
public void authenticate() {
		log.info("Authenticating user: " + this.name);
		WebSession result = null;
		try {
			result = getContext().getAuthenticationMethod().authenticate(
				getContext().getSessionManagementMethod(), this.authenticationCredentials, this);
		} catch (UnsupportedAuthenticationCredentialsException e) {
			log.error("User does not have the expected type of credentials:", e);
		}
		// no issues appear if a simultaneous call to #queueAuthentication() is made
		synchronized (this) {
			this.lastSuccessfulAuthTime = System.currentTimeMillis();
			this.authenticatedSession = result;
		}
	}
860036
def update(self, user, identity):
        
        return UserIdentityRequest(self).put(self.endpoint.update, user, identity)
889291
def create(self, request, *args, **kwargs):
        """"""
        if not request.user.is_authenticated:
            raise exceptions.NotFound

        return super().create(request, *args, **kwargs)
648161
def doVerify(self):
        

        # First, make sure that the user entered something
        openid_url = self.query.get('openid_identifier')
        if not openid_url:
            self.render(
                'Enter an OpenID Identifier to verify.',
                css_class='error',
                form_contents=openid_url)
            return

        immediate = 'immediate' in self.query
        use_sreg = 'use_sreg' in self.query
        use_pape = 'use_pape' in self.query
        use_stateless = 'use_stateless' in self.query
        oidconsumer = self.getConsumer(stateless=use_stateless)
        try:
            request = oidconsumer.begin(openid_url)
        except consumer.DiscoveryFailure as exc:
            fetch_error_string = 'Error in discovery: %s' % (
                cgi.escape(str(exc)))
            self.render(
                fetch_error_string,
                css_class='error',
                form_contents=openid_url)
        else:
            if request is None:
                msg = 'No OpenID services found for <code>%s</code>' % (
                    cgi.escape(openid_url), )
                self.render(msg, css_class='error', form_contents=openid_url)
            else:
                # Then, ask the library to begin the authorization.
                # Here we find out the identity server that will verify the
                # user's identity, and get a token that allows us to
                # communicate securely with the identity server.
                if use_sreg:
                    self.requestRegistrationData(request)

                if use_pape:
                    self.requestPAPEDetails(request)

                trust_root = self.server.base_url
                return_to = self.buildURL('process')
                if request.shouldSendRedirect():
                    redirect_url = request.redirectURL(
                        trust_root, return_to, immediate=immediate)
                    self.send_response(302)
                    self.send_header('Location', redirect_url)
                    self.writeUserHeader()
                    self.end_headers()
                else:
                    form_html = request.htmlMarkup(
                        trust_root,
                        return_to,
                        form_tag_attrs={'id': 'openid_message'},
                        immediate=immediate)

                    self.wfile.write(bytes(form_html, 'utf-8'))
199280
@Beta
    public MSICredentials withIdentityId(String identityId) {
        this.identityId = identityId;
        this.clientId = null;
        this.objectId = null;
        return this;
    }
1269796
def request_verification(self, user, identity):
        
        return UserIdentityRequest(self).put(self.endpoint.request_verification, user, identity)
188626
@Override
    public Uid authenticate(
            final ObjectClass objectClass,
            final String username,
            final GuardedString password,
            final OperationOptions options) {

        LOG.ok("User uthentication");

        // check objectclass
        if (objectClass == null || (!objectClass.equals(ObjectClass.ACCOUNT))) {
            throw new IllegalArgumentException("Invalid objectclass");
        }

        // check creadentials
        if (username == null || password == null) {
            throw new IllegalArgumentException("Invalid credentuals");
        }

        // get web service client
        final Provisioning provisioning = connection.getProvisioning();
        if (provisioning == null) {
            throw new IllegalStateException("Web Service client not found");
        }

        try {
            return new Uid(provisioning.authenticate(username, password.toString()));
        } catch (ProvisioningException e) {
            throw new ConnectorException("Authentication failed", e);
        } catch (Throwable t) {
            throw new ConnectorException("Communication exception", t);
        }
    }
313407
private void authorize(HttpSession session, Action action, Entity entity, String location)
            throws AuthorizationException, DataAccessException {
        AuthenticatedUser user  = (AuthenticatedUser)session.getAttribute("authenticatedUser");
        if (user == null && ApplicationContext.getServiceUser() != null) {
            String cuid = ApplicationContext.getServiceUser();
            user = new AuthenticatedUser(UserGroupCache.getUser(cuid));
        }

        if (user == null)
            throw new AuthorizationException(AuthorizationException.NOT_AUTHORIZED, "Authentication failure");
        if (action == Action.Create || action == Action.Delete) {
            if (!user.hasRole(Role.PROCESS_EXECUTION)) {
                throw new AuthorizationException(AuthorizationException.FORBIDDEN, "User "
                        + user.getCuid() + " not authorized for " + action + " on " + location);
            }
            logger.info("Asset mod request received from user: " + user.getCuid() + " for: " + location);
            UserAction userAction = new UserAction(user.getCuid(), action, entity, 0L, location);
            userAction.setSource(getClass().getSimpleName());
            ServiceLocator.getUserServices().auditLog(userAction);
        }
    }
696254
def handle_existing_user(self, provider, user, access, info):
        ""
        login(self.request, user)
        return redirect(self.get_login_redirect(provider, user, access))
1326029
def provider_parser(subparser):
    """"""
    identity_group = subparser.add_mutually_exclusive_group()
    identity_group.add_argument(
        "--auth-id", help="specify user id for authentication")
    identity_group.add_argument(
        "--auth-subid", help="specify subuser id for authentication")
    identity_group.add_argument(
        "--auth-subuser", help="specify subuser name for authentication")
    subparser.add_argument(
        "--auth-password", help="specify password for authentication")
    subparser.add_argument("--weight", help="specify the SRV record weight")
    subparser.add_argument("--port", help="specify the SRV record port")
1305783
def _getUserAuthObject(self, user, connection):
        
        credentials = self._getCredentials(user)
        userAuthObject = AutomaticUserAuthClient(user, connection, **credentials)
        return userAuthObject