diff --git a/Classes/Flowpack/OAuth2/Client/Eel/AuthorizationHelper.php b/Classes/Flowpack/OAuth2/Client/Eel/AuthorizationHelper.php new file mode 100644 index 0000000..9c867ca --- /dev/null +++ b/Classes/Flowpack/OAuth2/Client/Eel/AuthorizationHelper.php @@ -0,0 +1,33 @@ +oauthUriBuilder->getAuthorizationUri($providerName); + } + + /** + * All methods are considered safe + * + * @param string $methodName + * @return boolean + */ + public function allowsCallOfMethod($methodName) { + return true; + } +} \ No newline at end of file diff --git a/Classes/Flowpack/OAuth2/Client/Endpoint/AbstractHttpTokenEndpoint.php b/Classes/Flowpack/OAuth2/Client/Endpoint/AbstractHttpTokenEndpoint.php index 071f4be..bc8ac6e 100644 --- a/Classes/Flowpack/OAuth2/Client/Endpoint/AbstractHttpTokenEndpoint.php +++ b/Classes/Flowpack/OAuth2/Client/Endpoint/AbstractHttpTokenEndpoint.php @@ -12,10 +12,10 @@ * */ use Flowpack\OAuth2\Client\Exception as OAuth2Exception; -use TYPO3\Flow\Annotations as Flow; -use TYPO3\Flow\Http\Request; -use TYPO3\Flow\Http\Uri; -use TYPO3\Flow\Utility\Arrays; +use Neos\Flow\Annotations as Flow; +use Neos\Flow\Http\Request; +use Neos\Flow\Http\Uri; +use Neos\Utility\Arrays; /** */ @@ -24,7 +24,7 @@ abstract class AbstractHttpTokenEndpoint implements TokenEndpointInterface /** * @Flow\Inject - * @var \TYPO3\Flow\Http\Client\CurlEngine + * @var \Neos\Flow\Http\Client\CurlEngine */ protected $requestEngine; diff --git a/Classes/Flowpack/OAuth2/Client/Endpoint/FacebookTokenEndpoint.php b/Classes/Flowpack/OAuth2/Client/Endpoint/FacebookTokenEndpoint.php index 4564235..d0ae178 100644 --- a/Classes/Flowpack/OAuth2/Client/Endpoint/FacebookTokenEndpoint.php +++ b/Classes/Flowpack/OAuth2/Client/Endpoint/FacebookTokenEndpoint.php @@ -12,10 +12,10 @@ * */ use Flowpack\OAuth2\Client\Exception as OAuth2Exception; -use TYPO3\Flow\Annotations as Flow; -use TYPO3\Flow\Http\Request; -use TYPO3\Flow\Http\Uri; -use TYPO3\Flow\Log\SecurityLoggerInterface; +use Neos\Flow\Annotations as Flow; +use Neos\Flow\Http\Request; +use Neos\Flow\Http\Uri; +use Neos\Flow\Log\SecurityLoggerInterface; /** * @Flow\Scope("singleton") diff --git a/Classes/Flowpack/OAuth2/Client/Endpoint/GoogleTokenEndpoint.php b/Classes/Flowpack/OAuth2/Client/Endpoint/GoogleTokenEndpoint.php index 1fcd9bc..26d89a5 100644 --- a/Classes/Flowpack/OAuth2/Client/Endpoint/GoogleTokenEndpoint.php +++ b/Classes/Flowpack/OAuth2/Client/Endpoint/GoogleTokenEndpoint.php @@ -12,10 +12,10 @@ * */ use Flowpack\OAuth2\Client\Exception as OAuth2Exception; -use TYPO3\Flow\Annotations as Flow; -use TYPO3\Flow\Http\Request; -use TYPO3\Flow\Http\Uri; -use TYPO3\Flow\Log\SecurityLoggerInterface; +use Neos\Flow\Annotations as Flow; +use Neos\Flow\Http\Request; +use Neos\Flow\Http\Uri; +use Neos\Flow\Log\SecurityLoggerInterface; /** * @Flow\Scope("singleton") diff --git a/Classes/Flowpack/OAuth2/Client/Endpoint/Resolver.php b/Classes/Flowpack/OAuth2/Client/Endpoint/Resolver.php index cc46b58..402de58 100644 --- a/Classes/Flowpack/OAuth2/Client/Endpoint/Resolver.php +++ b/Classes/Flowpack/OAuth2/Client/Endpoint/Resolver.php @@ -11,9 +11,9 @@ * The TYPO3 project - inspiring people to share! * * */ -use TYPO3\Flow\Annotations as Flow; -use TYPO3\Flow\Configuration\ConfigurationManager; -use TYPO3\Flow\Object\ObjectManagerInterface; +use Neos\Flow\Annotations as Flow; +use Neos\Flow\Configuration\ConfigurationManager; +use Neos\Flow\ObjectManagement\ObjectManagerInterface; /** * @Flow\Scope("singleton") @@ -40,7 +40,7 @@ class Resolver */ public function getTokenEndpointForProvider($providerName) { - $tokenEndpointClassName = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, sprintf('TYPO3.Flow.security.authentication.providers.%s.providerOptions.tokenEndpointClassName', $providerName)); + $tokenEndpointClassName = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, sprintf('Neos.Flow.security.authentication.providers.%s.providerOptions.tokenEndpointClassName', $providerName)); if ($tokenEndpointClassName === null) { throw new \InvalidArgumentException(sprintf('In Settings.yaml, there was no "tokenEndpointClassName" option given for the provider "%s".', $providerName), 1383743372); } diff --git a/Classes/Flowpack/OAuth2/Client/Endpoint/TokenEndpointInterface.php b/Classes/Flowpack/OAuth2/Client/Endpoint/TokenEndpointInterface.php index 99887db..b2b9d00 100644 --- a/Classes/Flowpack/OAuth2/Client/Endpoint/TokenEndpointInterface.php +++ b/Classes/Flowpack/OAuth2/Client/Endpoint/TokenEndpointInterface.php @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! * * */ -use TYPO3\Flow\Annotations as Flow; +use Neos\Flow\Annotations as Flow; /** */ diff --git a/Classes/Flowpack/OAuth2/Client/Exception.php b/Classes/Flowpack/OAuth2/Client/Exception.php index 1f70ccb..be80736 100644 --- a/Classes/Flowpack/OAuth2/Client/Exception.php +++ b/Classes/Flowpack/OAuth2/Client/Exception.php @@ -13,6 +13,6 @@ /** */ -class Exception extends \TYPO3\Flow\Exception +class Exception extends \Neos\Flow\Exception { } diff --git a/Classes/Flowpack/OAuth2/Client/Exception/InvalidPartyDataException.php b/Classes/Flowpack/OAuth2/Client/Exception/InvalidPartyDataException.php index 7ce7c67..89bbb41 100644 --- a/Classes/Flowpack/OAuth2/Client/Exception/InvalidPartyDataException.php +++ b/Classes/Flowpack/OAuth2/Client/Exception/InvalidPartyDataException.php @@ -12,7 +12,7 @@ * */ use Flowpack\OAuth2\Client\Exception; -use TYPO3\Flow\Annotations as Flow; +use Neos\Flow\Annotations as Flow; /** * diff --git a/Classes/Flowpack/OAuth2/Client/Flow/AbstractFlow.php b/Classes/Flowpack/OAuth2/Client/Flow/AbstractFlow.php index 45b9e43..98e2796 100644 --- a/Classes/Flowpack/OAuth2/Client/Flow/AbstractFlow.php +++ b/Classes/Flowpack/OAuth2/Client/Flow/AbstractFlow.php @@ -12,12 +12,12 @@ * */ use Flowpack\OAuth2\Client\Token\AbstractClientToken; -use TYPO3\Flow\Annotations as Flow; -use TYPO3\Flow\Security\Authentication\TokenInterface; -use TYPO3\Flow\Security\Account; -use TYPO3\Flow\Security\Policy\PolicyService; -use TYPO3\Flow\Validation\ValidatorResolver; -use TYPO3\Party\Domain\Repository\PartyRepository; +use Neos\Flow\Annotations as Flow; +use Neos\Flow\Security\Authentication\TokenInterface; +use Neos\Flow\Security\Account; +use Neos\Flow\Security\Policy\PolicyService; +use Neos\Flow\Validation\ValidatorResolver; +use Neos\Party\Domain\Repository\PartyRepository; /** */ @@ -26,19 +26,19 @@ abstract class AbstractFlow implements FlowInterface /** * @Flow\Inject - * @var \TYPO3\Flow\Security\Context + * @var \Neos\Flow\Security\Context */ protected $securityContext; /** * @Flow\Inject - * @var \TYPO3\Flow\Persistence\PersistenceManagerInterface + * @var \Neos\Flow\Persistence\PersistenceManagerInterface */ protected $persistenceManager; /** * @Flow\Inject - * @var \TYPO3\Flow\Security\AccountRepository + * @var \Neos\Flow\Security\AccountRepository */ protected $accountRepository; diff --git a/Classes/Flowpack/OAuth2/Client/Flow/FacebookFlow.php b/Classes/Flowpack/OAuth2/Client/Flow/FacebookFlow.php index 736b3c7..29f3763 100644 --- a/Classes/Flowpack/OAuth2/Client/Flow/FacebookFlow.php +++ b/Classes/Flowpack/OAuth2/Client/Flow/FacebookFlow.php @@ -13,12 +13,12 @@ use Flowpack\OAuth2\Client\Exception\InvalidPartyDataException; use Flowpack\OAuth2\Client\Token\AbstractClientToken; -use TYPO3\Flow\Annotations as Flow; -use TYPO3\Party\Domain\Model\ElectronicAddress; -use TYPO3\Party\Domain\Model\Person; -use TYPO3\Party\Domain\Model\PersonName; -use TYPO3\Party\Domain\Repository\PartyRepository; -use TYPO3\Flow\Configuration\ConfigurationManager; +use Neos\Flow\Annotations as Flow; +use Neos\Party\Domain\Model\ElectronicAddress; +use Neos\Party\Domain\Model\Person; +use Neos\Party\Domain\Model\PersonName; +use Neos\Party\Domain\Repository\PartyRepository; +use Neos\Flow\Configuration\ConfigurationManager; /** */ @@ -59,7 +59,7 @@ public function createPartyAndAttachToAccountFor(AbstractClientToken $token) $party->addElectronicAddress($electronicAddress); $party->setPrimaryElectronicAddress($electronicAddress); - $partyValidator = $this->validatorResolver->getBaseValidatorConjunction('TYPO3\Party\Domain\Model\Person'); + $partyValidator = $this->validatorResolver->getBaseValidatorConjunction('Neos\Party\Domain\Model\Person'); $validationResult = $partyValidator->validate($party); if ($validationResult->hasErrors()) { throw new InvalidPartyDataException('The created party does not satisfy the requirements', 1384266207); @@ -67,7 +67,6 @@ public function createPartyAndAttachToAccountFor(AbstractClientToken $token) $account = $token->getAccount(); $account->setParty($party); - $this->accountRepository->update($account); $this->partyRepository->add($party); $this->persistenceManager->persistAll(); @@ -106,7 +105,7 @@ protected function initializeUserData(AbstractClientToken $token) protected function buildFacebookQuery() { $query = '/me'; - $this->authenticationServicesFields = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow.security.authentication.providers.FacebookOAuth2Provider.providerOptions.fields'); + $this->authenticationServicesFields = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.security.authentication.providers.FacebookOAuth2Provider.providerOptions.fields'); $fields = implode(',', $this->authenticationServicesFields); $query = $query . '?fields=' . $fields; diff --git a/Classes/Flowpack/OAuth2/Client/Flow/FlowInterface.php b/Classes/Flowpack/OAuth2/Client/Flow/FlowInterface.php index eae08f0..1ff5d2f 100644 --- a/Classes/Flowpack/OAuth2/Client/Flow/FlowInterface.php +++ b/Classes/Flowpack/OAuth2/Client/Flow/FlowInterface.php @@ -12,9 +12,9 @@ * */ use Flowpack\OAuth2\Client\Token\AbstractClientToken; -use TYPO3\Flow\Annotations as Flow; -use TYPO3\Flow\Security\Account; -use TYPO3\Flow\Security\Authentication\TokenInterface; +use Neos\Flow\Annotations as Flow; +use Neos\Flow\Security\Account; +use Neos\Flow\Security\Authentication\TokenInterface; /** */ @@ -27,7 +27,7 @@ interface FlowInterface public function getChargedAuthenticatedTokenHavingNoPartyAttached(); /** - * @param \TYPO3\Flow\Security\Authentication\TokenInterface|\Flowpack\OAuth2\Client\Token\AbstractClientToken $token + * @param \Neos\Flow\Security\Authentication\TokenInterface|\Flowpack\OAuth2\Client\Token\AbstractClientToken $token * @return TokenInterface */ public function getTokenOfForeignAccountOf(AbstractClientToken $token); diff --git a/Classes/Flowpack/OAuth2/Client/Flow/GoogleFlow.php b/Classes/Flowpack/OAuth2/Client/Flow/GoogleFlow.php index b145c97..48eeb32 100644 --- a/Classes/Flowpack/OAuth2/Client/Flow/GoogleFlow.php +++ b/Classes/Flowpack/OAuth2/Client/Flow/GoogleFlow.php @@ -13,10 +13,10 @@ use Flowpack\OAuth2\Client\Exception\InvalidPartyDataException; use Flowpack\OAuth2\Client\Token\AbstractClientToken; -use TYPO3\Flow\Annotations as Flow; -use TYPO3\Party\Domain\Model\ElectronicAddress; -use TYPO3\Party\Domain\Model\Person; -use TYPO3\Party\Domain\Model\PersonName; +use Neos\Flow\Annotations as Flow; +use Neos\Party\Domain\Model\ElectronicAddress; +use Neos\Party\Domain\Model\Person; +use Neos\Party\Domain\Model\PersonName; /** */ @@ -51,7 +51,7 @@ public function createPartyAndAttachToAccountFor(AbstractClientToken $token) $party->addElectronicAddress($electronicAddress); $party->setPrimaryElectronicAddress($electronicAddress); - $partyValidator = $this->validatorResolver->getBaseValidatorConjunction('TYPO3\Party\Domain\Model\Person'); + $partyValidator = $this->validatorResolver->getBaseValidatorConjunction('Neos\Party\Domain\Model\Person'); $validationResult = $partyValidator->validate($party); if ($validationResult->hasErrors()) { throw new InvalidPartyDataException('The created party does not satisfy the requirements', 1384266207); @@ -59,7 +59,6 @@ public function createPartyAndAttachToAccountFor(AbstractClientToken $token) $account = $token->getAccount(); $account->setParty($party); - $this->accountRepository->update($account); $this->partyRepository->add($party); $this->persistenceManager->persistAll(); diff --git a/Classes/Flowpack/OAuth2/Client/Provider/AbstractClientProvider.php b/Classes/Flowpack/OAuth2/Client/Provider/AbstractClientProvider.php index 7d47176..0551bec 100644 --- a/Classes/Flowpack/OAuth2/Client/Provider/AbstractClientProvider.php +++ b/Classes/Flowpack/OAuth2/Client/Provider/AbstractClientProvider.php @@ -11,8 +11,8 @@ * The TYPO3 project - inspiring people to share! * * */ -use TYPO3\Flow\Annotations as Flow; -use TYPO3\Flow\Security\Authentication\Provider\AbstractProvider; +use Neos\Flow\Annotations as Flow; +use Neos\Flow\Security\Authentication\Provider\AbstractProvider; /** */ diff --git a/Classes/Flowpack/OAuth2/Client/Provider/FacebookProvider.php b/Classes/Flowpack/OAuth2/Client/Provider/FacebookProvider.php index e4bbfa8..5b84fc4 100644 --- a/Classes/Flowpack/OAuth2/Client/Provider/FacebookProvider.php +++ b/Classes/Flowpack/OAuth2/Client/Provider/FacebookProvider.php @@ -12,12 +12,12 @@ * */ use Flowpack\OAuth2\Client\Token\AbstractClientToken; -use TYPO3\Flow\Annotations as Flow; -use TYPO3\Flow\Log\SecurityLoggerInterface; -use TYPO3\Flow\Security\Account; -use TYPO3\Flow\Security\Authentication\TokenInterface; -use TYPO3\Flow\Security\Exception\UnsupportedAuthenticationTokenException; -use TYPO3\Flow\Security\Policy\PolicyService; +use Neos\Flow\Annotations as Flow; +use Neos\Flow\Log\SecurityLoggerInterface; +use Neos\Flow\Security\Account; +use Neos\Flow\Security\Authentication\TokenInterface; +use Neos\Flow\Security\Exception\UnsupportedAuthenticationTokenException; +use Neos\Flow\Security\Policy\PolicyService; /** */ @@ -38,13 +38,7 @@ class FacebookProvider extends AbstractClientProvider /** * @Flow\Inject - * @var \TYPO3\Flow\Security\AccountRepository - */ - protected $accountRepository; - - /** - * @Flow\Inject - * @var \TYPO3\Flow\Security\Context + * @var \Neos\Flow\Security\Context */ protected $securityContext; @@ -62,7 +56,7 @@ class FacebookProvider extends AbstractClientProvider /** * @Flow\Inject - * @var \TYPO3\Flow\Persistence\PersistenceManagerInterface + * @var \Neos\Flow\Persistence\PersistenceManagerInterface */ protected $persistenceManager; @@ -70,7 +64,7 @@ class FacebookProvider extends AbstractClientProvider * Tries to authenticate the given token. Sets isAuthenticated to TRUE if authentication succeeded. * * @param TokenInterface $authenticationToken The token to be authenticated - * @throws \TYPO3\Flow\Security\Exception\UnsupportedAuthenticationTokenException + * @throws \Neos\Flow\Security\Exception\UnsupportedAuthenticationTokenException * @return void */ public function authenticate(TokenInterface $authenticationToken) @@ -102,14 +96,10 @@ public function authenticate(TokenInterface $authenticationToken) // From here, we surely know the user is considered authenticated against the remote service, // yet to check if there is an immanent account present. $authenticationToken->setAuthenticationStatus(TokenInterface::AUTHENTICATION_SUCCESSFUL); - /** @var $account \TYPO3\Flow\Security\Account */ + /** @var $account \Neos\Flow\Security\Account */ $account = null; $isNewCreatedAccount = false; $providerName = $this->name; - $accountRepository = $this->accountRepository; - $this->securityContext->withoutAuthorizationChecks(function () use ($tokenInformation, $providerName, $accountRepository, &$account) { - $account = $accountRepository->findByAccountIdentifierAndAuthenticationProviderName($tokenInformation['user_id'], $providerName); - }); if ($account === null) { $account = new Account(); @@ -124,7 +114,6 @@ public function authenticate(TokenInterface $authenticationToken) $roles[] = $this->policyService->getRole($roleIdentifier); } $account->setRoles($roles); - $this->accountRepository->add($account); } $authenticationToken->setAccount($account); @@ -133,9 +122,6 @@ public function authenticate(TokenInterface $authenticationToken) $account->setCredentialsSource($longLivedToken['access_token']); $account->authenticationAttempted(TokenInterface::AUTHENTICATION_SUCCESSFUL); - $this->accountRepository->update($account); - $this->persistenceManager->persistAll(); - // Only if defined a Party for the account is created if ($this->options['partyCreation'] && $isNewCreatedAccount) { $this->facebookFlow->createPartyAndAttachToAccountFor($authenticationToken); diff --git a/Classes/Flowpack/OAuth2/Client/Provider/GoogleProvider.php b/Classes/Flowpack/OAuth2/Client/Provider/GoogleProvider.php index 0eb9bdd..58825b8 100644 --- a/Classes/Flowpack/OAuth2/Client/Provider/GoogleProvider.php +++ b/Classes/Flowpack/OAuth2/Client/Provider/GoogleProvider.php @@ -12,15 +12,15 @@ * */ use Flowpack\OAuth2\Client\Token\AbstractClientToken; -use TYPO3\Flow\Annotations as Flow; -use TYPO3\Flow\Log\SecurityLoggerInterface; -use TYPO3\Flow\Security\Account; -use TYPO3\Flow\Security\Authentication\TokenInterface; -use TYPO3\Flow\Security\Exception\UnsupportedAuthenticationTokenException; -use TYPO3\Flow\Security\Policy\PolicyService; +use Neos\Flow\Annotations as Flow; +use Neos\Flow\Log\SecurityLoggerInterface; +use Neos\Flow\Security\Account; +use Neos\Flow\Security\Authentication\TokenInterface; +use Neos\Flow\Security\Exception\UnsupportedAuthenticationTokenException; +use Neos\Flow\Security\Policy\PolicyService; -use TYPO3\Flow\Configuration\ConfigurationManager; -use TYPO3\Flow\Object\ObjectManagerInterface; +use Neos\Flow\Configuration\ConfigurationManager; +use Neos\Flow\ObjectManagement\ObjectManagerInterface; /** */ @@ -54,13 +54,7 @@ class GoogleProvider extends AbstractClientProvider /** * @Flow\Inject - * @var \TYPO3\Flow\Security\AccountRepository - */ - protected $accountRepository; - - /** - * @Flow\Inject - * @var \TYPO3\Flow\Security\Context + * @var \Neos\Flow\Security\Context */ protected $securityContext; @@ -78,7 +72,7 @@ class GoogleProvider extends AbstractClientProvider /** * @Flow\Inject - * @var \TYPO3\Flow\Persistence\PersistenceManagerInterface + * @var \Neos\Flow\Persistence\PersistenceManagerInterface */ protected $persistenceManager; @@ -86,7 +80,7 @@ class GoogleProvider extends AbstractClientProvider * Tries to authenticate the given token. Sets isAuthenticated to TRUE if authentication succeeded. * * @param TokenInterface $authenticationToken The token to be authenticated - * @throws \TYPO3\Flow\Security\Exception\UnsupportedAuthenticationTokenException + * @throws \Neos\Flow\Security\Exception\UnsupportedAuthenticationTokenException * @return void */ public function authenticate(TokenInterface $authenticationToken) @@ -107,14 +101,10 @@ public function authenticate(TokenInterface $authenticationToken) // From here, we surely know the user is considered authenticated against the remote service, // yet to check if there is an immanent account present. $authenticationToken->setAuthenticationStatus(TokenInterface::AUTHENTICATION_SUCCESSFUL); - /** @var $account \TYPO3\Flow\Security\Account */ + /** @var $account \Neos\Flow\Security\Account */ $account = null; $isNewCreatedAccount = false; $providerName = $this->name; - $accountRepository = $this->accountRepository; - $this->securityContext->withoutAuthorizationChecks(function () use ($tokenInformation, $providerName, $accountRepository, &$account) { - $account = $accountRepository->findByAccountIdentifierAndAuthenticationProviderName($tokenInformation['sub'], $providerName); - }); if ($account === null) { $account = new Account(); @@ -129,7 +119,6 @@ public function authenticate(TokenInterface $authenticationToken) $roles[] = $this->policyService->getRole($roleIdentifier); } $account->setRoles($roles); - $this->accountRepository->add($account); } $authenticationToken->setAccount($account); @@ -139,9 +128,6 @@ public function authenticate(TokenInterface $authenticationToken) $account->setCredentialsSource($longLivedToken['access_token']); $account->authenticationAttempted(TokenInterface::AUTHENTICATION_SUCCESSFUL); - $this->accountRepository->update($account); - $this->persistenceManager->persistAll(); - // Only if defined a Party for the account is created if ($this->options['partyCreation'] && $isNewCreatedAccount) { $this->googleFlow->createPartyAndAttachToAccountFor($authenticationToken); @@ -165,7 +151,7 @@ public function getTokenClassNames() */ protected function buildScopeParameter() { - $scopes = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow.security.authentication.providers.GoogleOAuth2Provider.providerOptions.scopes'); + $scopes = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.security.authentication.providers.GoogleOAuth2Provider.providerOptions.scopes'); $scope = implode(' ', $scopes); $scopes = array('scope' => $scope); diff --git a/Classes/Flowpack/OAuth2/Client/Token/AbstractClientToken.php b/Classes/Flowpack/OAuth2/Client/Token/AbstractClientToken.php index 75af995..c8d136f 100644 --- a/Classes/Flowpack/OAuth2/Client/Token/AbstractClientToken.php +++ b/Classes/Flowpack/OAuth2/Client/Token/AbstractClientToken.php @@ -13,11 +13,11 @@ use Flowpack\OAuth2\Client\Endpoint\TokenEndpointInterface; use Flowpack\OAuth2\Client\Exception; -use TYPO3\Flow\Annotations as Flow; -use TYPO3\Flow\Log\SecurityLoggerInterface; -use TYPO3\Flow\Mvc\ActionRequest; -use TYPO3\Flow\Security\Authentication\Token\AbstractToken; -use TYPO3\Flow\Security\Authentication\TokenInterface; +use Neos\Flow\Annotations as Flow; +use Neos\Flow\Log\SecurityLoggerInterface; +use Neos\Flow\Mvc\ActionRequest; +use Neos\Flow\Security\Authentication\Token\AbstractToken; +use Neos\Flow\Security\Authentication\TokenInterface; /** */ diff --git a/Classes/Flowpack/OAuth2/Client/Token/FacebookToken.php b/Classes/Flowpack/OAuth2/Client/Token/FacebookToken.php index 330a5bd..51702ba 100644 --- a/Classes/Flowpack/OAuth2/Client/Token/FacebookToken.php +++ b/Classes/Flowpack/OAuth2/Client/Token/FacebookToken.php @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! * * */ -use TYPO3\Flow\Annotations as Flow; +use Neos\Flow\Annotations as Flow; /** */ diff --git a/Classes/Flowpack/OAuth2/Client/Token/GoogleToken.php b/Classes/Flowpack/OAuth2/Client/Token/GoogleToken.php index d3e8d52..e7c1b84 100644 --- a/Classes/Flowpack/OAuth2/Client/Token/GoogleToken.php +++ b/Classes/Flowpack/OAuth2/Client/Token/GoogleToken.php @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! * * */ -use TYPO3\Flow\Annotations as Flow; +use Neos\Flow\Annotations as Flow; /** */ diff --git a/Classes/Flowpack/OAuth2/Client/UriBuilder.php b/Classes/Flowpack/OAuth2/Client/UriBuilder.php index 5392fa2..9fa5100 100644 --- a/Classes/Flowpack/OAuth2/Client/UriBuilder.php +++ b/Classes/Flowpack/OAuth2/Client/UriBuilder.php @@ -11,9 +11,9 @@ * The TYPO3 project - inspiring people to share! * * */ -use TYPO3\Flow\Annotations as Flow; -use TYPO3\Flow\Configuration\ConfigurationManager; -use TYPO3\Flow\Http\Uri; +use Neos\Flow\Annotations as Flow; +use Neos\Flow\Configuration\ConfigurationManager; +use Neos\Flow\Http\Uri; /** * @Flow\Scope("singleton") @@ -72,7 +72,7 @@ public function getRedirectionEndpointUri($providerName) protected function getConfiguredOptionsByProviderName($providerName) { if (!array_key_exists($providerName, $this->providerOptionsByProviderName)) { - $providerOptions = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, sprintf('TYPO3.Flow.security.authentication.providers.%s.providerOptions', $providerName)); + $providerOptions = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, sprintf('Neos.Flow.security.authentication.providers.%s.providerOptions', $providerName)); if (!is_array($providerOptions)) { throw new \InvalidArgumentException(sprintf('The given provider name "%s" was not properly defined in the Settings (i.e. being defined and having a "providerOptions" key).', $providerName), 1383739910); } diff --git a/Classes/Flowpack/OAuth2/Client/Utility/FacebookApiClient.php b/Classes/Flowpack/OAuth2/Client/Utility/FacebookApiClient.php index b38b99b..87362d1 100644 --- a/Classes/Flowpack/OAuth2/Client/Utility/FacebookApiClient.php +++ b/Classes/Flowpack/OAuth2/Client/Utility/FacebookApiClient.php @@ -11,12 +11,12 @@ * The TYPO3 project - inspiring people to share! * * */ -use TYPO3\Flow\Annotations as Flow; -use TYPO3\Flow\Http\Client\CurlEngine; -use TYPO3\Flow\Http\Client\RequestEngineInterface; -use TYPO3\Flow\Http\Request; -use TYPO3\Flow\Http\Uri; -use TYPO3\Flow\Object\DependencyInjection\DependencyProxy; +use Neos\Flow\Annotations as Flow; +use Neos\Flow\Http\Client\CurlEngine; +use Neos\Flow\Http\Client\RequestEngineInterface; +use Neos\Flow\Http\Request; +use Neos\Flow\Http\Uri; +use Neos\Flow\ObjectManagement\DependencyInjection\DependencyProxy; /** * @Flow\Scope("singleton") @@ -51,7 +51,7 @@ class FacebookApiClient public function initializeObject() { if (($this->requestEngine instanceof DependencyProxy - && $this->requestEngine->_getClassName() === 'TYPO3\Flow\Http\Client\CurlEngine') + && $this->requestEngine->_getClassName() === 'Neos\Flow\Http\Client\CurlEngine') || $this->requestEngine instanceof CurlEngine) { $this->requestEngine->setOption(CURLOPT_CAINFO, FLOW_PATH_PACKAGES . 'Application/Flowpack.OAuth2.Client/Resources/Private/cacert.pem'); $this->requestEngine->setOption(CURLOPT_SSL_VERIFYPEER, true); @@ -61,7 +61,7 @@ public function initializeObject() /** * @param string $resource * @param string $method - * @return \TYPO3\Flow\Http\Response + * @return \Neos\Flow\Http\Response */ public function query($resource, $method = 'GET') { diff --git a/Classes/Flowpack/OAuth2/Client/Utility/GoogleApiClient.php b/Classes/Flowpack/OAuth2/Client/Utility/GoogleApiClient.php index a365cf7..2835bbc 100644 --- a/Classes/Flowpack/OAuth2/Client/Utility/GoogleApiClient.php +++ b/Classes/Flowpack/OAuth2/Client/Utility/GoogleApiClient.php @@ -11,12 +11,12 @@ * The TYPO3 project - inspiring people to share! * * */ -use TYPO3\Flow\Annotations as Flow; -use TYPO3\Flow\Http\Client\CurlEngine; -use TYPO3\Flow\Http\Client\RequestEngineInterface; -use TYPO3\Flow\Http\Request; -use TYPO3\Flow\Http\Uri; -use TYPO3\Flow\Object\DependencyInjection\DependencyProxy; +use Neos\Flow\Annotations as Flow; +use Neos\Flow\Http\Client\CurlEngine; +use Neos\Flow\Http\Client\RequestEngineInterface; +use Neos\Flow\Http\Request; +use Neos\Flow\Http\Uri; +use Neos\Flow\ObjectManagement\DependencyInjection\DependencyProxy; /** * @Flow\Scope("singleton") @@ -51,7 +51,7 @@ class GoogleApiClient public function initializeObject() { if (($this->requestEngine instanceof DependencyProxy - && $this->requestEngine->_getClassName() === 'TYPO3\Flow\Http\Client\CurlEngine') + && $this->requestEngine->_getClassName() === 'Neos\Flow\Http\Client\CurlEngine') || $this->requestEngine instanceof CurlEngine) { $this->requestEngine->setOption(CURLOPT_CAINFO, FLOW_PATH_PACKAGES . 'Application/Flowpack.OAuth2.Client/Resources/Private/cacert.pem'); $this->requestEngine->setOption(CURLOPT_SSL_VERIFYPEER, true); @@ -61,7 +61,7 @@ public function initializeObject() /** * @param string $resource * @param string $method - * @return \TYPO3\Flow\Http\Response + * @return \Neos\Flow\Http\Response */ public function query($resource, $method = 'GET') { diff --git a/Classes/Flowpack/OAuth2/Client/ViewHelpers/Uri/AuthorizationViewHelper.php b/Classes/Flowpack/OAuth2/Client/ViewHelpers/Uri/AuthorizationViewHelper.php index 0813f83..96eba84 100644 --- a/Classes/Flowpack/OAuth2/Client/ViewHelpers/Uri/AuthorizationViewHelper.php +++ b/Classes/Flowpack/OAuth2/Client/ViewHelpers/Uri/AuthorizationViewHelper.php @@ -12,8 +12,8 @@ * */ use Flowpack\OAuth2\Client\UriBuilder; -use TYPO3\Flow\Annotations as Flow; -use TYPO3\Fluid\Core\ViewHelper\AbstractViewHelper; +use Neos\Flow\Annotations as Flow; +use Neos\FluidAdaptor\Core\ViewHelper\AbstractViewHelper; /** */ diff --git a/Configuration/Objects.yaml b/Configuration/Objects.yaml index 9d9120f..a0dc593 100644 --- a/Configuration/Objects.yaml +++ b/Configuration/Objects.yaml @@ -2,32 +2,32 @@ Flowpack\OAuth2\Client\Utility\FacebookApiClient: properties: 'requestEngine': object: - name: 'TYPO3\Flow\Http\Client\CurlEngine' + name: 'Neos\Flow\Http\Client\CurlEngine' 'appSecret': - setting: 'TYPO3.Flow.security.authentication.providers.FacebookOAuth2Provider.providerOptions.clientSecret' + setting: 'Neos.Flow.security.authentication.providers.FacebookOAuth2Provider.providerOptions.clientSecret' Flowpack\OAuth2\Client\Endpoint\FacebookTokenEndpoint: properties: 'endpointUri': - setting: 'TYPO3.Flow.security.authentication.providers.FacebookOAuth2Provider.providerOptions.tokenEndpointUri' + setting: 'Neos.Flow.security.authentication.providers.FacebookOAuth2Provider.providerOptions.tokenEndpointUri' 'clientIdentifier': - setting: 'TYPO3.Flow.security.authentication.providers.FacebookOAuth2Provider.providerOptions.clientIdentifier' + setting: 'Neos.Flow.security.authentication.providers.FacebookOAuth2Provider.providerOptions.clientIdentifier' 'clientSecret': - setting: 'TYPO3.Flow.security.authentication.providers.FacebookOAuth2Provider.providerOptions.clientSecret' + setting: 'Neos.Flow.security.authentication.providers.FacebookOAuth2Provider.providerOptions.clientSecret' Flowpack\OAuth2\Client\Utility\GoogleApiClient: properties: 'requestEngine': object: - name: 'TYPO3\Flow\Http\Client\CurlEngine' + name: 'Neos\Flow\Http\Client\CurlEngine' 'appSecret': - setting: 'TYPO3.Flow.security.authentication.providers.GoogleOAuth2Provider.providerOptions.clientSecret' + setting: 'Neos.Flow.security.authentication.providers.GoogleOAuth2Provider.providerOptions.clientSecret' Flowpack\OAuth2\Client\Endpoint\GoogleTokenEndpoint: properties: 'endpointUri': - setting: 'TYPO3.Flow.security.authentication.providers.GoogleOAuth2Provider.providerOptions.tokenEndpointUri' + setting: 'Neos.Flow.security.authentication.providers.GoogleOAuth2Provider.providerOptions.tokenEndpointUri' 'clientIdentifier': - setting: 'TYPO3.Flow.security.authentication.providers.GoogleOAuth2Provider.providerOptions.clientIdentifier' + setting: 'Neos.Flow.security.authentication.providers.GoogleOAuth2Provider.providerOptions.clientIdentifier' 'clientSecret': - setting: 'TYPO3.Flow.security.authentication.providers.GoogleOAuth2Provider.providerOptions.clientSecret' + setting: 'Neos.Flow.security.authentication.providers.GoogleOAuth2Provider.providerOptions.clientSecret' diff --git a/Configuration/Settings.yaml b/Configuration/Settings.yaml index fa1146b..37a0040 100644 --- a/Configuration/Settings.yaml +++ b/Configuration/Settings.yaml @@ -1,5 +1,5 @@ -TYPO3: +Neos: Flow: security: authentication: @@ -7,61 +7,36 @@ TYPO3: FacebookOAuth2Provider: provider: Flowpack\OAuth2\Client\Provider\FacebookProvider providerOptions: - #authenticateRoles: ['TYPO3.Flow.SomeRole'] - authorizationEndpointUri: 'https://www.facebook.com/dialog/oauth' - - # redirectionEndpointUri must be some page on your site redirectionEndpointUri: 'https://www.yoursite.com/authentication/authenticate' - tokenEndpointUri: 'https://graph.facebook.com/oauth/access_token' tokenEndpointClassName: Flowpack\OAuth2\Client\Endpoint\FacebookTokenEndpoint clientIdentifier: 123456-your-client-identifier clientSecret: '-add-your-client-secret-here-' responseType: code - - # Reference for scopes https://developers.facebook.com/docs/facebook-login/permissions scopes: - email - - #Reference for fields https://developers.facebook.com/docs/graph-api/reference/user fields: - email - first_name - last_name - - # per default an account with a role (if 'authenticateRoles' is defined) is only created - # if 'partyCreation' is TRUE a Party with the given 'fields' is created - partyCreation: TRUE - + partyCreation: true display: popup - - GoogleOAuth2Provider: provider: Flowpack\OAuth2\Client\Provider\GoogleProvider providerOptions: - #authenticateRoles: ['TYPO3.Flow.SomeRole'] - authorizationEndpointUri: 'https://accounts.google.com/o/oauth2/auth' - - # redirectionEndpointUri must be some page on your site which is defined in your google API manager - # https://console.developers.google.com/apis/library redirectionEndpointUri: 'https://www.yoursite.com/authentication/authenticate' - tokenEndpointUri: 'https://accounts.google.com/o/oauth2/token' tokenEndpointClassName: Flowpack\OAuth2\Client\Endpoint\GoogleTokenEndpoint - clientIdentifier: '123456youridentifier.apps.googleusercontent.com' + clientIdentifier: 123456youridentifier.apps.googleusercontent.com clientSecret: '-add-your-client-secret-here-' responseType: code - - # Reference for scopes https://developers.google.com/identity/protocols/googlescopes scopes: - - https://www.googleapis.com/auth/userinfo.email - - https://www.googleapis.com/auth/userinfo.profile - - # per default an account with a role (if 'authenticateRoles' is defined) is only created - # if 'partyCreation' is TRUE a Party with the given 'fields' is created - partyCreation: TRUE - + - 'https://www.googleapis.com/auth/userinfo.email' + - 'https://www.googleapis.com/auth/userinfo.profile' + partyCreation: true display: popup - + Fusion: + defaultContext: + OAuth2Client: Flowpack\OAuth2\Client\Eel\AuthorizationHelper \ No newline at end of file diff --git a/composer.json b/composer.json index 143d9cc..2bb389c 100644 --- a/composer.json +++ b/composer.json @@ -1,22 +1,101 @@ { - "name":"flowpack/oauth2-client", - "description":"An OAuth 2.0 authorization framework client for the web application framework TYPO3 Flow.", - "keywords":["OAuth2", "TYPO3", "Flow", "Flowpack", "Client"], - "type":"typo3-flow-package", - "authors":[ - { - "name":"Adrian Föder" - }, - { - "name":"Philipp Maier" - } - ], - "require":{ - "typo3/flow": ">=2.1" - }, - "autoload":{ - "psr-0":{ - "Flowpack\\OAuth2\\Client":"Classes/" - } - } -} + "name": "flowpack/oauth2-client", + "description": "An OAuth 2.0 authorization framework client for the web application framework TYPO3 Flow.", + "keywords": [ + "OAuth2", + "TYPO3", + "Flow", + "Flowpack", + "Client" + ], + "type": "typo3-flow-package", + "authors": [ + { + "name": "Adrian Föder" + }, + { + "name": "Philipp Maier" + } + ], + "require": { + "typo3/flow": ">=2.1" + }, + "autoload": { + "psr-0": { + "Flowpack\\OAuth2\\Client": "Classes/" + } + }, + "extra": { + "applied-flow-migrations": [ + "TYPO3.Neos-201407061038", + "TYPO3.FLOW3-201201261636", + "TYPO3.Fluid-201205031303", + "TYPO3.FLOW3-201205292145", + "TYPO3.FLOW3-201206271128", + "TYPO3.FLOW3-201209201112", + "TYPO3.Flow-201209251426", + "TYPO3.Flow-201211151101", + "TYPO3.Flow-201212051340", + "TYPO3.TypoScript-130516234520", + "TYPO3.TypoScript-130516235550", + "TYPO3.TYPO3CR-130523180140", + "TYPO3.Flow-201310031523", + "TYPO3.Flow-201405111147", + "TYPO3.Neos-201409071922", + "TYPO3.TYPO3CR-140911160326", + "TYPO3.Neos-201410010000", + "TYPO3.TYPO3CR-141101082142", + "TYPO3.Neos-20141113115300", + "TYPO3.Fluid-20141113120800", + "TYPO3.Flow-20141113121400", + "TYPO3.Fluid-20141121091700", + "TYPO3.Neos-20141218134700", + "TYPO3.Fluid-20150214130800", + "TYPO3.Neos-20150303231600", + "TYPO3.TYPO3CR-20150510103823", + "TYPO3.Flow-20151113161300", + "TYPO3.Form-20160601101500", + "TYPO3.Flow-20161115140400", + "TYPO3.Flow-20161115140430", + "Neos.Flow-20161124204700", + "Neos.Flow-20161124204701", + "Neos.Twitter.Bootstrap-20161124204912", + "Neos.Form-20161124205254", + "Neos.Flow-20161124224015", + "Neos.Party-20161124225257", + "Neos.Eel-20161124230101", + "Neos.Setup-20161124230842", + "Neos.Imagine-20161124231742", + "Neos.Media-20161124233100", + "Neos.Neos-20161125002322", + "Neos.ContentRepository-20161125012000", + "Neos.Fusion-20161125013710", + "Neos.Setup-20161125014759", + "Neos.Fusion-20161125104701", + "Neos.Neos-20161125104802", + "Neos.Neos-20161125122412", + "Neos.Flow-20161125124112", + "TYPO3.FluidAdaptor-20161130112935", + "Neos.Fusion-20161201202543", + "Neos.Neos-20161201222211", + "Neos.Fusion-20161202215034", + "Neos.ContentRepository.Search-20161210231100", + "Neos.Fusion-20161219092345", + "Neos.ContentRepository-20161219093512", + "Neos.Media-20161219094126", + "Neos.Neos-20161219094403", + "Neos.Neos-20161219122512", + "Neos.Fusion-20161219130100", + "Neos.Neos-20161220163741", + "Neos.Neos-20170115114620", + "Neos.Fusion-20170120013047", + "Neos.Flow-20170125103800", + "Neos.Seo-20170127154600", + "Neos.Flow-20170127183102", + "Neos.Fusion-20180211175500", + "Neos.Fusion-20180211184832", + "Neos.Flow-20180415105700", + "Neos.Neos-20180907103800" + ] + } +} \ No newline at end of file