summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'OAuth/src/AuthorizationProvider/AccessToken.php')
-rw-r--r--OAuth/src/AuthorizationProvider/AccessToken.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/OAuth/src/AuthorizationProvider/AccessToken.php b/OAuth/src/AuthorizationProvider/AccessToken.php
new file mode 100644
index 00000000..de4fd0e2
--- /dev/null
+++ b/OAuth/src/AuthorizationProvider/AccessToken.php
@@ -0,0 +1,35 @@
+<?php
+
+namespace MediaWiki\Extensions\OAuth\AuthorizationProvider;
+
+use League\OAuth2\Server\Exception\OAuthServerException;
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+
+abstract class AccessToken extends AuthorizationProvider implements IAccessTokenProvider {
+
+ /**
+ * @param ServerRequestInterface $request
+ * @param ResponseInterface $response
+ *
+ * @return ResponseInterface
+ * @throws OAuthServerException
+ */
+ public function getAccessTokens(
+ ServerRequestInterface $request, ResponseInterface $response
+ ): ResponseInterface {
+ $this->logAccessTokenRequest( $request );
+ return $this->server->respondToAccessTokenRequest( $request, $response );
+ }
+
+ /**
+ * @param ServerRequestInterface $request
+ */
+ protected function logAccessTokenRequest( ServerRequestInterface $request ) {
+ $this->logger->info(
+ "OAuth2: Access token request - Grant type {grant}, client id: {client}", [
+ 'grant' => $this->getGrantSingleton()->getIdentifier(),
+ 'client' => $this->getClientIdFromRequest( $request )
+ ] );
+ }
+}