OneLogin_Saml2_Utils::getSelfURLNoQuery PHP Method

getSelfURLNoQuery() public static method

Returns the URL of the current host + current view.
public static getSelfURLNoQuery ( ) : string
return string
    public static function getSelfURLNoQuery()
    {
        $selfURLNoQuery = self::getSelfURLhost();
        $infoWithBaseURLPath = self::buildWithBaseURLPath($_SERVER['SCRIPT_NAME']);
        if (!empty($infoWithBaseURLPath)) {
            $selfURLNoQuery .= $infoWithBaseURLPath;
        } else {
            $selfURLNoQuery .= $_SERVER['SCRIPT_NAME'];
        }
        if (isset($_SERVER['PATH_INFO'])) {
            $selfURLNoQuery .= $_SERVER['PATH_INFO'];
        }
        return $selfURLNoQuery;
    }

Usage Example

Example #1
0
 /**
  * Obtains the SSO URL containing the AuthRequest
  * message deflated.
  *
  * @param OneLogin_Saml2_Settings $settings Settings
  */
 public function getRedirectUrl($returnTo = null)
 {
     $settings = $this->auth->getSettings();
     $authnRequest = new OneLogin_Saml2_AuthnRequest($settings);
     $parameters = array('SAMLRequest' => $authnRequest->getRequest());
     if (!empty($returnTo)) {
         $parameters['RelayState'] = $returnTo;
     } else {
         $parameters['RelayState'] = OneLogin_Saml2_Utils::getSelfURLNoQuery();
     }
     $url = OneLogin_Saml2_Utils::redirect($this->auth->getSSOurl(), $parameters, true);
     return $url;
 }
All Usage Examples Of OneLogin_Saml2_Utils::getSelfURLNoQuery