diff --git a/.env.example b/.env.example index 35eb445..0152884 100644 --- a/.env.example +++ b/.env.example @@ -47,9 +47,3 @@ LDC_WEB_CIDR_MANUAL_ALLOWED_LIST= # GITLAB API GITLAB_URL= GITLAB_TOKEN= - -# SAML IDP -## URL list separated by comma -SAML_SP_URL_LIST="" -## json sp config -SAML_SP_CONFIG='' diff --git a/app/Interfaces/SpsConfigInterface.php b/app/Interfaces/SpsConfigInterface.php new file mode 100644 index 0000000..1e87835 --- /dev/null +++ b/app/Interfaces/SpsConfigInterface.php @@ -0,0 +1,42 @@ +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) + ) + ); + } +} diff --git a/config/samlidp.php b/config/samlidp.php index dacd96b..b26958d 100644 --- a/config/samlidp.php +++ b/config/samlidp.php @@ -1,8 +1,14 @@ url()] = $sp->url(); + $sp_configs[$sp->acsBase64()] = [ + 'destination' => $sp->destination(), + 'logout' => $sp->logout(), + 'certificate' => $sp->certificate() + ]; } return [ @@ -55,7 +61,7 @@ return [ // 'encrypt_assertion' => false // ]. // ],. - 'sp' => json_decode(env('SAML_SP_CONFIG', "{}"), true), + 'sp' => $sp_configs, // If you need to redirect after SLO depending on SLO initiator // Key is beginning of HTTP_REFERER value from SERVER, value is redirect path. diff --git a/manifest.yaml b/manifest.yaml index 0a1b774..e5ce0be 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -25,8 +25,6 @@ data: SENTRY_LARAVEL_DSN: "${APP_SENTRY_LARAVEL_DSN}" GITLAB_URL: "https://${CI_SERVER_HOST}" GITLAB_TOKEN: "${APP_GITLAB_TOKEN}" - SAML_SP_URL_LIST: "${APP_SAML_SP_URL_LIST}" - SAML_SP_CONFIG: "${APP_SAML_SP_CONFIG}" --- apiVersion: v1 diff --git a/storage/samlidp/config.php b/storage/samlidp/config.php new file mode 100644 index 0000000..c30ac2d --- /dev/null +++ b/storage/samlidp/config.php @@ -0,0 +1,25 @@ + 'https://le-gaulois-pro.s-web.test' + }; + } +}