diff --git a/src/AuthzContext.php b/src/AuthzContext.php index 3459cf4..5e07042 100644 --- a/src/AuthzContext.php +++ b/src/AuthzContext.php @@ -137,6 +137,19 @@ class AuthzContext { $this->expires = $info['expires']; } + public function dump(): array { + return [ + 'authed' => $this->authed, + 'error' => $this->error, + 'method' => $this->method, + 'type' => $this->type, + 'user' => $this->userId, + 'app' => $this->appId, + 'scope' => $this->scope, + 'expires' => $this->expires, + ]; + } + private function attemptBasicAppAuthInternal(string $remoteAddr, string $clientId, string $clientSecret = ''): void { try { $this->handleRpcResponse($this->rpcClient->procedure('hanyuu:oauth2:attemptAppAuth', [ diff --git a/src/OAuth2/OAuth2Routes.php b/src/OAuth2/OAuth2Routes.php index d61c42e..70fa04c 100644 --- a/src/OAuth2/OAuth2Routes.php +++ b/src/OAuth2/OAuth2Routes.php @@ -124,6 +124,7 @@ class OAuth2Routes extends RouteHandler { if(!$authz->hasAuthed()) { $authzHeader = false; $authz->attemptBasicAppAuth( + (string)filter_input(INPUT_SERVER, 'REMOTE_ADDR'), (string)$content->getParam('client_id'), (string)$content->getParam('client_secret') );