Пример #1
0
 /**
  * Returns the real OPAuth object
  *
  * @return \Opauth
  */
 public function getOpauth()
 {
     if ($this->opauth === NULL) {
         $this->workarounds();
         $configuration = $this->configuration->getConfiguration();
         $this->opauth = new \Opauth($configuration, FALSE);
     }
     return $this->opauth;
 }
 /**
  * Return an OPAuth account.
  * If an account with the given data does not exist a new account will be created.
  *
  * @param \Hfrahmann\Opauth\Opauth\Response $opauthResponse
  * @return \TYPO3\Flow\Security\Account
  * @throws \Hfrahmann\Opauth\Exception
  */
 public function getAccount(\Hfrahmann\Opauth\Opauth\Response $opauthResponse)
 {
     if ($opauthResponse == NULL) {
         throw new \Hfrahmann\Opauth\Exception("OpauthResponse cannot be NULL.", 1381596921);
     }
     $accountIdentifier = $this->createAccountIdentifier($opauthResponse);
     $authenticationProviderName = $this->configuration->getAuthenticationProviderName();
     $account = $this->accountRepository->findByAccountIdentifierAndAuthenticationProviderName($accountIdentifier, $authenticationProviderName);
     if ($account === NULL) {
         $roleIdentifier = $this->configuration->getDefaultRoleIdentifier();
         $roleIdentifierArray = array();
         if (is_array($roleIdentifier)) {
             $roleIdentifierArray = $roleIdentifier;
         }
         if (is_string($roleIdentifier)) {
             $roleIdentifierArray = array($roleIdentifier);
         }
         $account = $this->accountFactory->createAccountWithPassword($accountIdentifier, NULL, $roleIdentifierArray, $authenticationProviderName);
     }
     return $account;
 }
 /**
  * @param string $strategy
  * @return string
  */
 public function render($strategy = '')
 {
     $opauthSettings = $this->opauthConfiguration->getConfiguration();
     $uri = $opauthSettings['path'] . $strategy;
     return $uri;
 }