phpCAS
This commit is contained in:
@ -20,7 +20,7 @@ final class LogoutListener
|
|||||||
{
|
{
|
||||||
if ('CAS' == $this->parameterBag->get('modeAuth')) {
|
if ('CAS' == $this->parameterBag->get('modeAuth')) {
|
||||||
$request = $event->getRequest();
|
$request = $event->getRequest();
|
||||||
$host = $request->headers->get('X-Forwarded-Host') ?? $request->getHost().($request->getPort() ? ':'.$request->getPort() : '');
|
$host = $request->headers->get('host');
|
||||||
$scheme = $request->headers->get('X-Forwarded-Proto') ?? $request->getScheme();
|
$scheme = $request->headers->get('X-Forwarded-Proto') ?? $request->getScheme();
|
||||||
$url = $scheme.'://'.$host;
|
$url = $scheme.'://'.$host;
|
||||||
\phpCAS::client(CAS_VERSION_2_0, $this->parameterBag->get('casHost'), (int) $this->parameterBag->get('casPort'), $this->parameterBag->get('casPath'), $url, false);
|
\phpCAS::client(CAS_VERSION_2_0, $this->parameterBag->get('casHost'), (int) $this->parameterBag->get('casPort'), $this->parameterBag->get('casPath'), $url, false);
|
||||||
|
@ -96,14 +96,21 @@ class DynamicAuthenticator extends AbstractAuthenticator
|
|||||||
private function authenticateWithCas(Request $request): Passport
|
private function authenticateWithCas(Request $request): Passport
|
||||||
{
|
{
|
||||||
// Récupérer l'hôte d'origine derrière le reverse proxy
|
// Récupérer l'hôte d'origine derrière le reverse proxy
|
||||||
$host = $request->headers->get('X-Forwarded-Host') ?? $request->getHost().($request->getPort() ? ':'.$request->getPort() : '');
|
$host = $request->headers->get('host');
|
||||||
$scheme = $request->headers->get('X-Forwarded-Proto') ?? $request->getScheme();
|
$scheme = $request->headers->get('X-Forwarded-Proto') ?? $request->getScheme();
|
||||||
|
|
||||||
// Construire l'URL
|
// Construire l'URL
|
||||||
$url = $scheme.'://'.$host;
|
$url = $scheme.'://'.$host;
|
||||||
|
|
||||||
// \phpCAS::setDebug('/tmp/logcas.log');
|
// \phpCAS::setDebug('/tmp/logcas.log');
|
||||||
\phpCAS::client(CAS_VERSION_2_0, $this->parameterBag->get('casHost'), (int) $this->parameterBag->get('casPort'), $this->parameterBag->get('casPath'), $url, false);
|
\phpCAS::client(
|
||||||
|
CAS_VERSION_2_0,
|
||||||
|
$this->parameterBag->get('casHost'),
|
||||||
|
(int) $this->parameterBag->get('casPort'),
|
||||||
|
$this->parameterBag->get('casPath'),
|
||||||
|
$url,
|
||||||
|
false);
|
||||||
|
|
||||||
\phpCAS::setNoCasServerValidation();
|
\phpCAS::setNoCasServerValidation();
|
||||||
\phpCAS::forceAuthentication();
|
\phpCAS::forceAuthentication();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user