Skip to content

Commit

Permalink
Merge pull request #6 from 365Werk/analysis-GDlbRO
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
HergenD authored Sep 16, 2020
2 parents a8b3194 + f4c3153 commit 575510f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/JwtAuthRoles.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class JwtAuthRoles
{
private static function getKid(string $jwt): ?string
{
if (!Str::is('*.*.*', $jwt)) {
if (! Str::is('*.*.*', $jwt)) {
throw AuthException::auth(422, 'Malformed JWT');
}

Expand All @@ -30,7 +30,7 @@ private static function getKid(string $jwt): ?string

private static function getClaims(string $jwt): ?object
{
if (!Str::is('*.*.*', $jwt)) {
if (! Str::is('*.*.*', $jwt)) {
throw AuthException::auth(422, 'Malformed JWT');
}

Expand All @@ -42,7 +42,7 @@ private static function getClaims(string $jwt): ?object

private static function jwkToPem(object $jwk): ?string
{
if (!isset($jwk->e) || !isset($jwk->n)) {
if (! isset($jwk->e) || ! isset($jwk->n)) {
throw AuthException::auth(500, 'Malformed jwk');
}

Expand All @@ -59,13 +59,13 @@ private static function getJwk(string $kid, string $uri): ?string
{
$response = Http::get($uri);
$json = $response->getBody();
if (!$json) {
if (! $json) {
throw AuthException::auth(404, 'jwks endpoint not found');
}

$jwks = json_decode($json, false);

if (!$jwks || !isset($jwks->keys) || !is_array($jwks->keys)) {
if (! $jwks || ! isset($jwks->keys) || ! is_array($jwks->keys)) {
throw AuthException::auth(404, 'No JWKs found');
}

Expand All @@ -82,13 +82,13 @@ private static function getPem(string $kid, string $uri): ?string
{
$response = Http::get($uri);
$json = $response->getBody();
if (!$json) {
if (! $json) {
throw AuthException::auth(404, 'pem endpoint not found');
}

$pems = json_decode($json, false);

if (!$pems || !isset($pems->publicKeys) || !is_object($pems->publicKeys)) {
if (! $pems || ! isset($pems->publicKeys) || ! is_object($pems->publicKeys)) {
throw AuthException::auth(404, 'pem not found');
}

Expand Down

0 comments on commit 575510f

Please sign in to comment.