@@ -32,12 +32,8 @@ public function initializeObject(): void
3232 * @param Uri $returnToUri
3333 * @param string $serviceType
3434 * @param string $serviceName
35- * @throws OAuthClientException
36- * @throws \Doctrine\ORM\ORMException
37- * @throws \Doctrine\ORM\OptimisticLockException
38- * @throws \Doctrine\ORM\TransactionRequiredException
39- * @throws \Neos\Flow\Mvc\Exception\StopActionException
40- * @throws \Neos\Flow\Mvc\Exception\UnsupportedRequestTypeException
35+ * @throws
36+ * FIXME: Re-Implement
4137 */
4238 public function startAuthorizationAction (string $ clientId , string $ clientSecret , Uri $ returnToUri , string $ serviceType , string $ serviceName ): void
4339 {
@@ -54,44 +50,26 @@ public function startAuthorizationAction(string $clientId, string $clientSecret,
5450 /**
5551 * Finish OAuth2 authorization
5652 *
57- * @param string $code
58- * @param string $state
59- * @param string $serviceType
60- * @param string $serviceName
61- * @param string $scope
53+ * This action passes the given state and code to the OAuth client in order to finish an authorization in progress.
54+ * If the authorization could be finished successfully, the action will redirect to the return URI which was specified
55+ * while starting the authorization.
56+ *
57+ * @param string $serviceType The OAuth service type, ie. the type identifying the package / class implementing OAuth
58+ * @param string $serviceName The OAuth service name, ie. the identifier of the concrete configuration of the given OAuth service implementation
59+ * @param string $state The state by which the OAuth client can find the authorization in progress
60+ * @param string $code The code issued by the OAuth server
6261 * @throws
6362 */
64- public function finishAuthorizationAction (string $ code , string $ state , string $ serviceType , string $ serviceName , string $ scope = '' ): void
63+ public function finishAuthorizationAction (string $ serviceType , string $ serviceName , string $ state , string $ code ): void
6564 {
6665 if (!isset ($ this ->serviceTypes [$ serviceType ])) {
6766 throw new OAuthClientException (sprintf ('OAuth: Failed finishing OAuth2 authorization because the given service type "%s" is unknown. ' , $ serviceName ), 1511193117184 );
6867 }
69-
7068 $ client = new $ this ->serviceTypes [$ serviceType ]($ serviceName );
71- assert ($ client instanceof OAuthClient);
72-
73- $ returnToUri = $ client ->finishAuthorization ($ code , $ state , $ scope );
74- $ this ->redirectToUri ($ returnToUri );
75- }
76-
77- /**
78- * Refresh OAuth2 authorization
79- *
80- * @param string $clientId
81- * @param string $returnToUri
82- * @param string $serviceName
83- * @throws
84- */
85- public function refreshAuthorizationAction (string $ clientId , string $ returnToUri , string $ serviceName ): void
86- {
87- // if (!isset($this->serviceTypes[$serviceName])) {
88- // throw new OAuthClientException('Unknown client service.', 1511193121713);
89- // }
90- //
91- // /** @var $client OAuthClient * */
92- // $client = new $this->serviceTypes[$serviceName];
93- // $authorizeUri = $client->refreshAuthorization($clientId, $returnToUri);
94- // $this->redirectToUri($authorizeUri);
69+ if (!$ client instanceof OAuthClient) {
70+ throw new OAuthClientException (sprintf ('OAuth: Failed finishing authorization because of unexpected class type: "%s" must implement %s. ' , get_class ($ client ), OAuthClient::class), 1568735389 );
71+ }
72+ $ this ->redirectToUri ($ client ->finishAuthorization ($ state , $ code ));
9573 }
9674
9775 /**
0 commit comments