Skip to content
Snippets Groups Projects
Commit 6794f43f authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

Adding getRedirectURL() functionality

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@58 44740490-163a-0410-bde0-09ae8108e29a
parent d48656f0
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,8 @@ class SimpleSAML_Bindings_SAML20_HTTPRedirect { ...@@ -29,7 +29,8 @@ class SimpleSAML_Bindings_SAML20_HTTPRedirect {
$this->metadata = $metadatastore; $this->metadata = $metadatastore;
} }
public function sendMessage($request, $remoteentityid, $relayState = null, $endpoint = 'SingleSignOnService', $direction = 'SAMLRequest', $mode = 'SP') { public function getRedirectURL($request, $remoteentityid, $relayState = null, $endpoint = 'SingleSignOnService', $direction = 'SAMLRequest', $mode = 'SP') {
if (!in_array($mode, array('SP', 'IdP'))) { if (!in_array($mode, array('SP', 'IdP'))) {
throw new Exception('mode parameter of sendMessage() must be either SP or IdP'); throw new Exception('mode parameter of sendMessage() must be either SP or IdP');
} }
...@@ -39,7 +40,12 @@ class SimpleSAML_Bindings_SAML20_HTTPRedirect { ...@@ -39,7 +40,12 @@ class SimpleSAML_Bindings_SAML20_HTTPRedirect {
} }
$md = $this->metadata->getMetaData($remoteentityid, $metadataset); $md = $this->metadata->getMetaData($remoteentityid, $metadataset);
$idpTargetUrl = $md[$endpoint];
$realendpoint = $endpoint;
if ($endpoint == 'SingleLogoutServiceResponse' && !isset($md[$endpoint]))
$realendpoint = 'SingleLogoutService';
$idpTargetUrl = $md[$realendpoint];
if (!isset($idpTargetUrl) or $idpTargetUrl == '') { if (!isset($idpTargetUrl) or $idpTargetUrl == '') {
throw new Exception('Could not find endpoint [' .$endpoint . '] in metadata for [' . $remoteentityid . '] (looking in ' . $metadataset . ')'); throw new Exception('Could not find endpoint [' .$endpoint . '] in metadata for [' . $remoteentityid . '] (looking in ' . $metadataset . ')');
...@@ -51,6 +57,14 @@ class SimpleSAML_Bindings_SAML20_HTTPRedirect { ...@@ -51,6 +57,14 @@ class SimpleSAML_Bindings_SAML20_HTTPRedirect {
if (isset($relayState)) { if (isset($relayState)) {
$redirectURL .= "&RelayState=" . urlencode($relayState); $redirectURL .= "&RelayState=" . urlencode($relayState);
} }
return $redirectURL;
}
public function sendMessage($request, $remoteentityid, $relayState = null, $endpoint = 'SingleSignOnService', $direction = 'SAMLRequest', $mode = 'SP') {
$redirectURL = $this->getRedirectURL($request, $remoteentityid, $relayState, $endpoint, $direction, $mode);
if ($this->configuration->getValue('debug')) { if ($this->configuration->getValue('debug')) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment