Skip to content

Commit

Permalink
Added service name (cunsumer name) when security entry point was invo…
Browse files Browse the repository at this point in the history
…ked.
  • Loading branch information
korotovsky committed Jan 12, 2015
1 parent 794ef84 commit 02697d4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,50 +30,31 @@ class SingleSignOnAuthenticationEntryPoint implements AuthenticationEntryPointIn
*/
private $uriSigner;

/**
* @var
*/
private $ssoScheme;

/**
* @var string
*/
private $ssoHost;

/**
* @var string
*/
private $ssoLoginPath;

/**
* @param \Symfony\Component\HttpKernel\UriSigner $signer
* @param \Symfony\Component\Security\Http\HttpUtils $httpUtils
* @param array $options
* @param string $ssoScheme
* @param string $ssoHost
* @param string $ssoLoginPath
*/
public function __construct(UriSigner $signer, HttpUtils $httpUtils, array $options = array(), $ssoScheme, $ssoHost, $ssoLoginPath)
public function __construct(UriSigner $signer, HttpUtils $httpUtils, array $options = array())
{
$this->httpUtils = $httpUtils;
$this->uriSigner = $signer;

$this->options = new ParameterBag($options);

$this->ssoScheme = $ssoScheme;
$this->ssoHost = $ssoHost;
$this->ssoLoginPath = $ssoLoginPath;
}

public function start(Request $request, AuthenticationException $authException = null)
{
$host = $this->ssoHost;
$scheme = $this->ssoScheme;
$path = rtrim($this->ssoLoginPath, '/');
$host = $this->options->get('sso_host');
$scheme = $this->options->get('sso_scheme');
$path = rtrim($this->options->get('sso_path'), '/');
$ssoService = $this->options->get('sso_service');

$checkPath = $this->options->get('check_path');

$targetPathParameter = $this->options->get('target_path_parameter');
$failurePathParameter = $this->options->get('failure_path_parameter');
$ssoServiceParameter = $this->options->get('sso_service_parameter');

$redirectUri = $request->getUriForPath($checkPath);

Expand All @@ -88,6 +69,10 @@ public function start(Request $request, AuthenticationException $authException =
$loginUrl = sprintf('%s&%s=%s', $loginUrl, $failurePathParameter, rawurlencode($failureUrl));
}

if ($ssoService) {
$loginUrl = sprintf('%s&%s=%s', $loginUrl, $ssoServiceParameter, $ssoService);
}

$loginUrl = $this->uriSigner->sign($loginUrl);

return $this->httpUtils->createRedirectResponse($request, $loginUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public function __construct()
$this->addOption('sso_host');
$this->addOption('sso_path', '/_sso/');
$this->addOption('sso_failure_path', '/login');

$this->addOption('sso_service', '');
$this->addOption('sso_service_parameter', 'service');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
<argument type="service" id="krtv_single_sign_on_service_provider.uri_signer" />
<argument type="service" id="security.http_utils"/>
<argument/> <!-- firewall options -->
<argument type="string">%krtv_single_sign_on_service_provider.host_scheme%</argument>
<argument type="string">%krtv_single_sign_on_service_provider.host%</argument>
<argument type="string">%krtv_single_sign_on_service_provider.login_path%</argument>
</service>

<service id="krtv_single_sign_on_service_provider.security.authentication.provider" class="%krtv_single_sign_on_service_provider.authentication.provider.otp.class%">
Expand Down

0 comments on commit 02697d4

Please sign in to comment.