Get's primary user details and logins user if one is not logged in
Add's new address if user is logged in.
@throws Exception
436567
public function setPrimaryAmazonUserData()
    {
        $oUtils = $this->_getContainer()->getUtils();
        $sShopSecureHomeUrl = $this->_getContainer()->getConfig()->getShopSecureHomeUrl();

        //Get primary user data from Amazon
        $oData = $this->_getContainer()->getClient()->getOrderReferenceDetails();
        $oOrderReferenceDetail = isset($oData->GetOrderReferenceDetailsResult->OrderReferenceDetails)
            ? $oData->GetOrderReferenceDetailsResult->OrderReferenceDetails : null;

        if ($oOrderReferenceDetail === null
            || isset($oOrderReferenceDetail->Destination->PhysicalDestination) === false
        ) {
            $oUtils->redirect($sShopSecureHomeUrl.'cl=user&fnc=cleanAmazonPay', false);
            return;
        }

        //Creating and(or) logging user
        $sStatus = (string)$oOrderReferenceDetail->OrderReferenceStatus->State;

        if ($sStatus === 'Draft') {
            //Manage primary user data
            $oAmazonData = $oOrderReferenceDetail->Destination->PhysicalDestination;
            $this->_managePrimaryUserData($oAmazonData);

            //Recalculate basket to get shipping price for created user
            $this->_getContainer()->getSession()->getBasket()->onUpdate();

            //Redirect with registered user or new shipping address to payment page
            $oUtils->redirect($sShopSecureHomeUrl.'cl=payment', false);
            return;
        }

        $oUtils->redirect($sShopSecureHomeUrl.'cl=user&fnc=cleanAmazonPay', false);
    }
162652
@Override
  public final String getUserName() {
    if (httpReq.getUserPrincipal() != null) {
      return httpReq.getUserPrincipal().getName();
    }
    return null;
  }
743990
public function onConstruct()
    {
        $this->userLinkedSourcesModel = new UserLinkedSources();
        $this->userModel = new Users();

        if (!isset($this->config->jwt)) {
            throw new Exception('You need to configure your app JWT');
        }
    }
1303383
private User addUser(String userName)
    {
        User user = new User();
        PersonalDetail personalDetail = new PersonalDetail(userName, userName + "Password", "Single");
        user.setUserId(userName);
        user.setEmailId(userName + "@" + userName + ".com");
        user.setFirstName(userName);
        user.setLastName(userName);
        user.setTweets(new HashSet<Tweets>());
        user.setPersonalDetail(personalDetail);
        return user;
    }
607959
public function getUser()
    {
        if (is_null($this->user)) {
            /**
             * @var \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException $exception
             */
            $exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException::class);
            throw $exception;
        }

        return $this->user;
    }
249889
public login logout() throws Exception
	{
		if(sessionid == null || sessionid.length() <= 0)
			throw new Exception("User not logged-in");
		
		login logout_obj = new login();
		logout_obj.set_sessionid(sessionid);
		
		login result = login.delete(this, logout_obj);
		sessionid = null;
		user_name = null;
		password = null;
		return result;
	}
1249764
public function getCurrentUser()
    {
        if ($token = $this->tokenStorage->getToken()) {
            if (($user = $token->getUser()) && is_object($user)) {
                return $user;
            }
        }

        throw new \Exception('Authorization needed', ErrorCode::CODE_UNAUTHORIZED);
    }
1321298
public static Optional<String> getCurrentTenant() {
        final UserDetails userDetails = getCurrentUser();
        if (!(userDetails instanceof UserPrincipal)) {
            return Optional.empty();
        }

        final UserPrincipal userPrincipal = (UserPrincipal) userDetails;
        return Optional.of(userPrincipal.getTenant().trim());
    }
624497
public static function getCurrentUser($dontThrowException = false)
    {
        if (!self::$currentUser instanceof MbWpUser) {

            try {
                self::$currentUser = self::findOrFail(get_current_user_id());
            } catch (\Exception $e) {
                self::$currentUser = new self();
                self::$currentUser->forceFill([
                    'ID'            => 0,
                    'user_login'    => 'Anonymous',
                    'user_nicename' => 'Anonymous',
                    'display_name'  => 'Anonymous',
                ]);
            }
        }

        if (!self::$currentUser->exists && !$dontThrowException) {
            throw new \Exception("No users have been logged in!");
        }

        return self::$currentUser;
    }
506207
@Override
  public final void addUser(final String pUserName,
    final String pPassw, final String pRole) throws Exception {
    String query = "select USERTOMCAT.ITSUSER as ITSUSER, ITSROLE"
      + " from USERTOMCAT join USERROLETOMCAT"
        + " on USERROLETOMCAT.ITSUSER = USERTOMCAT.ITSUSER;";
    IRecordSet<RS> recordSet = null;
    try {
      this.srvDatabase.setIsAutocommit(false);
      this.srvDatabase.
        setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED);
      this.srvDatabase.beginTransaction();
      recordSet = getSrvDatabase().retrieveRecords(query);
      if (recordSet.moveToFirst()) {
        throw new Exception("There are already user credentials!");
      }
      String addUserQ =
        "insert into USERTOMCAT (ITSUSER, ITSPASSWORD) values ('" + pUserName
          + "', '" + pPassw + "');";
      String addUserRoleQ =
        "insert into USERROLETOMCAT (ITSUSER, ITSROLE) values ('" + pUserName
          + "', '" + pRole + "');";
      this.srvDatabase.executeQuery(addUserQ);
      this.srvDatabase.executeQuery(addUserRoleQ);
      this.srvDatabase.commitTransaction();
      this.isThereAnyUser = true;
    } catch (Exception ex) {
      this.srvDatabase.rollBackTransaction();
      throw ex;
    } finally {
      this.srvDatabase.releaseResources();
      if (recordSet != null) {
        recordSet.close();
      }
    }
  }
204595
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
      throws RemoteException {
    // Get the UserService.
    UserServiceInterface userService = adManagerServices.get(session, UserServiceInterface.class);

    // Get the current user.
    User user = userService.getCurrentUser();

    System.out.printf(
        "User with ID %d, name '%s', email '%s', and role '%s' is the current user.%n",
        user.getId(), user.getName(), user.getEmail(), user.getRoleName());
  }
608603
public int users_getLoggedInUser()
    throws FacebookException, IOException {
    T result = this.callMethod(FacebookMethod.USERS_GET_LOGGED_IN_USER);
    return extractInt(result);
  }
928707
public function getName()
    {
        if (!array_key_exists(self::NAME, $this->passwd)) {
            throw new \Exception('Could not get user name from passwd.');
        }
        return $this->passwd[self::NAME];
    }
57341
public void afterPropertiesSet() throws Exception {
        if (loginService == null) {
            loginService = new SimpleLoginService();
            ((SimpleLoginService) loginService).setName(realm);
        }
    }
1364290
public User getLoggedInUser() {
    User user = null;

    final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    if (authentication != null) {
      final Object principal = authentication.getPrincipal();

      // principal can be "anonymousUser" (String)
      if (principal instanceof UserDetails) {
        user = userDetailsConverter.convert((UserDetails) principal);
      }
    }
    return user;
  }
1226756
protected function setup()
    {
        if (null === $this->getIdentity()) {
            throw new Exception\RuntimeException('A value for the identity was not provided');
        }

        if (null === $this->getCredential()) {
            throw new Exception\RuntimeException('A credential value was not provided');
        }

        $this->storeAuthenticationResult(AuthenticationResult::FAILURE_UNCATEGORIZED);
    }
787483
function getUserProfile()
    {
        $this->api->api_base_url    = $this->getEndpoint().'/2.0/';

        $data = $this->api->api( "users/profile.json?apikey=".$this->api->access_token );

        if ( ! isset( $data->global_user_id ) ){
            throw new Exception( "User profile request failed! {$this->providerId} returned an invalid response.", 6 );
        }

        $this->user->profile->identifier    = @ $data->global_user_id;
        $this->user->profile->displayName   = @ $data->name;
        $this->user->profile->email         = @ $data->email;
        $this->user->profile->photoURL      = @ $data->avatar;

        $data = $this->api->api( "helper/account-details.json?apikey=".$this->api->access_token );

        $this->user->profile->webSiteURL    = @ $data->contact->url;
        $this->user->profile->firstName     = @ $data->contact->fname;
        $this->user->profile->lastName      = @ $data->contact->lname;
        $this->user->profile->address       = @ $data->contact->address1;
        if(isset($data->contact->address2) && strlen($data->contact->address2)){
            $this->user->profile->address .= ', '.$data->contact->address2;
        }
        $this->user->profile->zip           = @ $data->contact->zip;
        $this->user->profile->city          = @ $data->contact->city;
        $this->user->profile->country       = @ $data->contact->country;
        $this->user->profile->phone         = @ $data->contact->phone;

        return $this->user->profile;
    }