@@ -129,14 +129,16 @@ class OneLogin_Saml2_Auth
129129 * (SAMLResponse, LogoutResponse). If the SAMLResponse was
130130 * encrypted, by default tries to return the decrypted XML
131131 *
132- * @var string
132+ * @var string|\DomDocument|null
133133 */
134134 private $ _lastResponse ;
135135
136136 /**
137137 * Initializes the SP SAML instance.
138138 *
139139 * @param array|object|null $oldSettings Setting data (You can provide a OneLogin_Saml_Settings, the settings object of the Saml folder implementation)
140+ *
141+ * @throws OneLogin_Saml2_Error
140142 */
141143 public function __construct ($ oldSettings = null )
142144 {
@@ -157,11 +159,12 @@ public function getSettings()
157159 * Set the strict mode active/disable
158160 *
159161 * @param bool $value Strict parameter
162+ *
160163 * @throws OneLogin_Saml2_Error
161164 */
162165 public function setStrict ($ value )
163166 {
164- if (! ( is_bool ($ value) )) {
167+ if (!is_bool ($ value )) {
165168 throw new OneLogin_Saml2_Error (
166169 'Invalid value passed to setStrict() ' ,
167170 OneLogin_Saml2_Error::SETTINGS_INVALID_SYNTAX
@@ -177,12 +180,13 @@ public function setStrict($value)
177180 * @param string|null $requestId The ID of the AuthNRequest sent by this SP to the IdP
178181 *
179182 * @throws OneLogin_Saml2_Error
183+ * @throws OneLogin_Saml2_ValidationError
180184 */
181185 public function processResponse ($ requestId = null )
182186 {
183187 $ this ->_errors = array ();
184188 $ this ->_errorReason = null ;
185- if (isset ($ _POST ) && isset ( $ _POST ['SAMLResponse ' ])) {
189+ if (isset ($ _POST ['SAMLResponse ' ])) {
186190 // AuthnResponse -- HTTP_POST Binding
187191 $ response = new OneLogin_Saml2_Response ($ this ->_settings , $ _POST ['SAMLResponse ' ]);
188192 $ this ->_lastResponse = $ response ->getXMLDocument ();
@@ -215,21 +219,21 @@ public function processResponse($requestId = null)
215219 /**
216220 * Process the SAML Logout Response / Logout Request sent by the IdP.
217221 *
218- * @param bool $keepLocalSession When false will destroy the local session, otherwise will keep it
219- * @param string|null $requestId The ID of the LogoutRequest sent by this SP to the IdP
220- * @param bool $retrieveParametersFromServer
221- * @param callable $cbDeleteSession
222- * @param bool $stay True if we want to stay (returns the url string) False to redirect
222+ * @param bool $keepLocalSession When false will destroy the local session, otherwise will keep it
223+ * @param string|null $requestId The ID of the LogoutRequest sent by this SP to the IdP
224+ * @param bool $retrieveParametersFromServer True if we want to use parameters from $_SERVER to validate the signature
225+ * @param callable $cbDeleteSession Callback to be executed to delete session
226+ * @param bool $stay True if we want to stay (returns the url string) False to redirect
223227 *
224- * @return string|void
228+ * @return string|null
225229 *
226230 * @throws OneLogin_Saml2_Error
227231 */
228232 public function processSLO ($ keepLocalSession = false , $ requestId = null , $ retrieveParametersFromServer = false , $ cbDeleteSession = null , $ stay = false )
229233 {
230234 $ this ->_errors = array ();
231235 $ this ->_errorReason = null ;
232- if (isset ($ _GET ) && isset ( $ _GET ['SAMLResponse ' ])) {
236+ if (isset ($ _GET ['SAMLResponse ' ])) {
233237 $ logoutResponse = new OneLogin_Saml2_LogoutResponse ($ this ->_settings , $ _GET ['SAMLResponse ' ]);
234238 $ this ->_lastResponse = $ logoutResponse ->getXML ();
235239 if (!$ logoutResponse ->isValid ($ requestId , $ retrieveParametersFromServer )) {
@@ -247,7 +251,7 @@ public function processSLO($keepLocalSession = false, $requestId = null, $retrie
247251 }
248252 }
249253 }
250- } else if (isset ($ _GET ) && isset ( $ _GET ['SAMLRequest ' ])) {
254+ } else if (isset ($ _GET ['SAMLRequest ' ])) {
251255 $ logoutRequest = new OneLogin_Saml2_LogoutRequest ($ this ->_settings , $ _GET ['SAMLRequest ' ]);
252256 $ this ->_lastRequest = $ logoutRequest ->getXML ();
253257 if (!$ logoutRequest ->isValid ($ retrieveParametersFromServer )) {
@@ -296,10 +300,13 @@ public function processSLO($keepLocalSession = false, $requestId = null, $retrie
296300 * Redirects the user to the url past by parameter
297301 * or to the url that we defined in our SSO Request.
298302 *
299- * @param string $url The target URL to redirect the user.
300- * @param array $parameters Extra parameters to be passed as part of the url
301- * @param bool $stay True if we want to stay (returns the url string) False to redirect
303+ * @param string $url The target URL to redirect the user.
304+ * @param array $parameters Extra parameters to be passed as part of the url
305+ * @param bool $stay True if we want to stay (returns the url string) False to redirect
306+ *
302307 * @return string|null
308+ *
309+ * @throws OneLogin_Saml2_Error
303310 */
304311 public function redirectTo ($ url = '' , $ parameters = array (), $ stay = false )
305312 {
@@ -386,7 +393,7 @@ public function getSessionIndex()
386393 /**
387394 * Returns the SessionNotOnOrAfter
388395 *
389- * @return DateTime |null The SessionNotOnOrAfter of the assertion
396+ * @return int |null The SessionNotOnOrAfter of the assertion
390397 */
391398 public function getSessionExpiration ()
392399 {
@@ -452,14 +459,16 @@ public function getAttributeWithFriendlyName($friendlyName)
452459 /**
453460 * Initiates the SSO process.
454461 *
455- * @param string|null $returnTo The target URL the user should be returned to after login.
456- * @param array $parameters Extra parameters to be added to the GET
457- * @param bool $forceAuthn When true the AuthNReuqest will set the ForceAuthn='true'
458- * @param bool $isPassive When true the AuthNReuqest will set the Ispassive='true'
459- * @param bool $stay True if we want to stay (returns the url string) False to redirect
460- * @param bool $setNameIdPolicy When true the AuthNReuqest will set a nameIdPolicy element
462+ * @param string|null $returnTo The target URL the user should be returned to after login.
463+ * @param array $parameters Extra parameters to be added to the GET
464+ * @param bool $forceAuthn When true the AuthNRequest will set the ForceAuthn='true'
465+ * @param bool $isPassive When true the AuthNRequest will set the Ispassive='true'
466+ * @param bool $stay True if we want to stay (returns the url string) False to redirect
467+ * @param bool $setNameIdPolicy When true the AuthNRueqest will set a nameIdPolicy element
461468 *
462469 * @return string|null If $stay is True, it return a string with the SLO URL + LogoutRequest + parameters
470+ *
471+ * @throws OneLogin_Saml2_Error
463472 */
464473 public function login ($ returnTo = null , $ parameters = array (), $ forceAuthn = false , $ isPassive = false , $ stay = false , $ setNameIdPolicy = true )
465474 {
@@ -560,7 +569,7 @@ public function getSSOurl()
560569 /**
561570 * Gets the SLO url.
562571 *
563- * @return string The url of the Single Logout Service
572+ * @return string|null The url of the Single Logout Service
564573 */
565574 public function getSLOurl ()
566575 {
@@ -591,7 +600,6 @@ public function getLastRequestID()
591600 *
592601 * @return string A base64 encoded signature
593602 *
594- * @throws Exception
595603 * @throws OneLogin_Saml2_Error
596604 */
597605 public function buildRequestSignature ($ samlRequest , $ relayState , $ signAlgorithm = XMLSecurityKey::RSA_SHA1 )
@@ -634,7 +642,6 @@ public function buildRequestSignature($samlRequest, $relayState, $signAlgorithm
634642 *
635643 * @return string A base64 encoded signature
636644 *
637- * @throws Exception
638645 * @throws OneLogin_Saml2_Error
639646 */
640647 public function buildResponseSignature ($ samlResponse , $ relayState , $ signAlgorithm = XMLSecurityKey::RSA_SHA1 )
0 commit comments