Skip to content

Commit c21bea2

Browse files
committed
Metric logger second example
1 parent 7f42290 commit c21bea2

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

lib/Server/AuthorizationServer.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace SimpleSAML\Module\oidc\Server;
44

5+
use CirrusIdentity\SSP\Utils\MetricLogger;
56
use Lcobucci\JWT\UnencryptedToken;
67
use League\OAuth2\Server\AuthorizationServer as OAuth2AuthorizationServer;
78
use LogicException;
@@ -75,6 +76,19 @@ public function validateAuthorizationRequest(ServerRequestInterface $request): O
7576
$resultBag = $this->requestRulesManager->check($request, $rulesToExecute);
7677
} catch (OidcServerException $exception) {
7778
$reason = sprintf("%s %s", $exception->getMessage(), $exception->getHint() ?? '');
79+
MetricLogger::getInstance()->logMetric(
80+
'oidc',
81+
'error',
82+
[
83+
'message' => $reason,
84+
'oidc' => [
85+
'endpoint' => 'authorize',
86+
]
87+
// authorize endpoint doesn't contain secrets so okay to log all params
88+
+ $request->getQueryParams()
89+
90+
]
91+
);
7892
throw new BadRequest($reason);
7993
}
8094

0 commit comments

Comments
 (0)