@@ -255,7 +255,7 @@ public function requestAccessToken(string $serviceName, string $clientId, string
255255 * @return string
256256 * @throws OAuthClientException
257257 */
258- public function generateAuthorizationIdForAuthorizationCodeGrant (string $ clientId )
258+ public function generateAuthorizationIdForAuthorizationCodeGrant (string $ clientId ): string
259259 {
260260 return Authorization::generateAuthorizationIdForAuthorizationCodeGrant ($ this ->getServiceType (), $ this ->getServiceName (), $ clientId );
261261 }
@@ -278,6 +278,14 @@ public function startAuthorization(string $clientId, string $clientSecret, UriIn
278278
279279 /**
280280 * Start OAuth authorization with the Authorization Code flow
281+ * based on a specified authorization identifier.
282+ *
283+ * Note that, if you use this method, it is your responsibility to provide a
284+ * meaningful authorization id. You might weaken the security of your
285+ * application if you use an id which is deterministic or can be guessed by
286+ * an attacker.
287+ *
288+ * If in doubt, always use startAuthorization() instead.
281289 *
282290 * @param string $clientId The client id, as provided by the OAuth server
283291 * @param string $clientSecret The client secret, provided by the OAuth server
@@ -511,8 +519,8 @@ public function renderFinishAuthorizationUri(): string
511519 }
512520
513521 /**
514- * Helper method to set metadate on an Authorization instance, makes sure the
515- * change is persisted.
522+ * Helper method to set metadata on an Authorization instance. Changes are
523+ * persisted immediately .
516524 *
517525 * @param string $authorizationId
518526 * @param string $metadata
@@ -522,7 +530,7 @@ public function setAuthorizationMetadata(string $authorizationId, string $metada
522530 {
523531 $ authorization = $ this ->getAuthorization ($ authorizationId );
524532 if ($ authorization === null ) {
525- throw new \RuntimeException (' Authorization not found ' , 1631821719 );
533+ throw new \RuntimeException (sprintf ( ' Failed setting authorization metadata: authorization %s was not found ', $ authorizationId ) , 1631821719 );
526534 }
527535 $ authorization ->setMetadata ($ metadata );
528536
0 commit comments