Fixed oversights with basic authentication.

This commit is contained in:
Pachira 2024-08-26 18:09:02 +00:00
parent bda95c747c
commit 868a06f036
2 changed files with 14 additions and 0 deletions

View file

@ -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', [

View file

@ -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')
);