53 lines
1 KiB
PHP
53 lines
1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Traits\Enums;
|
||
|
|
|
||
|
|
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)
|
||
|
|
)
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|