diff --git a/.gitignore b/.gitignore index 5826402..38cdbd7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ composer.phar composer.lock .DS_Store +.idea \ No newline at end of file diff --git a/config/saml2.php b/config/saml2.php index fae987d..5b15fc1 100644 --- a/config/saml2.php +++ b/config/saml2.php @@ -214,6 +214,13 @@ 'singleLogoutService' => [ 'url' => '' ], + + /* + * Valid Until (in seconds) + * Default value will be 30 days + * + */ + 'validUntil' => 2592000, ], /* diff --git a/src/Auth.php b/src/Auth.php index ce94894..80781c1 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -184,10 +184,10 @@ public function sls($retrieveParametersFromServer = false) * @throws \Exception * @throws \InvalidArgumentException If metadata is not correctly set */ - public function getMetadata() + public function getMetadata($validUntil = null) { $settings = $this->base->getSettings(); - $metadata = $settings->getSPMetadata(); + $metadata = $settings->getSPMetadata(false, $validUntil); $errors = $settings->validateMetadata($metadata); if (!count($errors)) { diff --git a/src/Http/Controllers/Saml2Controller.php b/src/Http/Controllers/Saml2Controller.php index edd4962..a7a821d 100644 --- a/src/Http/Controllers/Saml2Controller.php +++ b/src/Http/Controllers/Saml2Controller.php @@ -26,7 +26,8 @@ class Saml2Controller extends Controller */ public function metadata(Auth $auth) { - $metadata = $auth->getMetadata(); + $validUntil = config('saml2.sp.validUntil'); + $metadata = $auth->getMetadata($validUntil); return response($metadata, 200, ['Content-Type' => 'text/xml']); }