Skip to content
Snippets Groups Projects
Commit 63185dac authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Handled configurable scope in token issuer

parent a6b63bee
No related branches found
No related tags found
No related merge requests found
...@@ -117,7 +117,24 @@ class TokenBuilder { ...@@ -117,7 +117,24 @@ class TokenBuilder {
'aud' => $audience 'aud' => $audience
); );
$conf = $this->getTokenIssuerConfig($audience);
if (property_exists($conf, 'aud')) {
$payload['aud'] = $conf->aud;
}
if (property_exists($conf, 'scope')) {
$payload['scope'] = $conf->scope;
}
return JWT::encode($payload, $keyPair->privateKey, $keyPair->alg, $keyPair->keyId); return JWT::encode($payload, $keyPair->privateKey, $keyPair->alg, $keyPair->keyId);
} }
private function getTokenIssuerConfig($audience) {
foreach ($this->locator->config->tokenIssuer->services as $service) {
if ($service->id === $audience) {
return $service;
}
}
throw new \Exception("Unable to find configuration for " . $audience);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment