ldc-supportweb/app/Traits/Enums/SpsConfigTrait.php
2025-04-23 12:24:31 +02:00

53 lines
1.1 KiB
PHP

<?php
namespace App\Traits\Enums;
// @phpstan-ignore trait.unused
trait SpsConfigTrait
{
/**
* acsBase64 method
* Return destination url base64 encoded.
*
* @return string
*/
public function acsBase64(): string
{
return base64_encode($this->destination());
}
/**
* destination method
* Return acs url concatenated with url.
*
* @return string
*/
public function destination(): string
{
return $this->url() . "/saml2/support/acs";
}
/**
* logout method
* Return sls url concatenated with url.
*
* @return string
*/
public function logout(): string
{
return $this->url() . "/saml2/support/sls";
}
/**
* certificate method
* Return certificate (.pem) file from kebab case of Enum name.
*
* @return string
*/
public function certificate(): string
{
return 'file://' . storage_path(
sprintf(
'samlidp/%s.pem',
str()->kebab($this->name)
)
);
}
}