forked from BeSimple/BeSimpleSsoAuthBundle
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
212 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace BeSimple\SsoAuthBundle\Controller; | ||
|
||
use Symfony\Component\DependencyInjection\ContainerAware; | ||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
|
||
class Controller extends ContainerAware | ||
{ | ||
public function __construct(ContainerInterface $container) | ||
{ | ||
$this->container = $container; | ||
} | ||
|
||
protected function render($view, array $parameters) | ||
{ | ||
return $this | ||
->container | ||
->get('templating') | ||
->renderResponse($view, $parameters) | ||
; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{% extends "::base.html.twig" %} | ||
|
||
{% block body %} | ||
|
||
<h1>You're about to logout</h1> | ||
|
||
<p class="notice"> | ||
Follow this link to logout from external | ||
<strong>{{ provider.protocolName | upper }}</strong> server : | ||
<a href="{{ provider.server.logoutUrl }}">{{ provider.server.logoutUrl }}</a>. | ||
</p> | ||
|
||
{% endblock body %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
namespace BeSimple\SsoAuthBundle\Security\Http\Logout; | ||
|
||
use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpFoundation\RedirectResponse; | ||
use Symfony\Bundle\FrameworkBundle\HttpKernel; | ||
use BeSimple\SsoAuthBundle\Sso\SsoFactory; | ||
|
||
class SsoLogoutSuccessHandler implements LogoutSuccessHandlerInterface | ||
{ | ||
/** | ||
* @var HttpKernel | ||
*/ | ||
protected $httpKernel; | ||
|
||
/** | ||
* @var SsoFactory | ||
*/ | ||
protected $ssoFactory; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $config; | ||
|
||
/** | ||
* @param HttpKernel $httpKernel | ||
* @param SsoProviderFactory $ssoFactory | ||
* @param array $ssoConfig | ||
*/ | ||
public function __construct(HttpKernel $httpKernel, SsoFactory $ssoFactory, array $config) | ||
{ | ||
$this->httpKernel = $httpKernel; | ||
$this->ssoFactory = $ssoFactory; | ||
$this->config = $config; | ||
} | ||
|
||
/** | ||
* @param Request $request | ||
* @param null|AuthenticationException $authException | ||
* @return Response | ||
*/ | ||
public function onLogoutSuccess(Request $request) | ||
{ | ||
$action = $this->config['logout_action']; | ||
$provider = $this->ssoFactory->createProvider($this->config['server'], $this->config['check_path']); | ||
|
||
if ($action) { | ||
return $this->httpKernel->forward($action, array( | ||
'provider' => $provider, | ||
'request' => $request, | ||
)); | ||
} | ||
|
||
return new RedirectResponse($provider->getServer()->getLogoutUrl()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.