Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add token on redirect when hit login url #173

Open
busharthussain opened this issue Dec 13, 2018 · 1 comment
Open

Add token on redirect when hit login url #173

busharthussain opened this issue Dec 13, 2018 · 1 comment

Comments

@busharthussain
Copy link

I want to add extra paramters in that login function but this function is present in vendor file. how i can send extra paramters in that function before redirect ?

public function login($returnTo = null, array $parameters = array(), $forceAuthn = false, $isPassive = false, $stay = false, $setNameIdPolicy = true)
{
$authnRequest = new AuthnRequest($this->_settings, $forceAuthn, $isPassive, $setNameIdPolicy);

    $this->_lastRequest = $authnRequest->getXML();
    $this->_lastRequestID = $authnRequest->getId();

    $samlRequest = $authnRequest->getRequest();
    $parameters['SAMLRequest'] = $samlRequest;

    if (!empty($returnTo)) {
        $parameters['RelayState'] = $returnTo;
    } else {
        $parameters['RelayState'] = Utils::getSelfRoutedURLNoQuery();
    }

    $security = $this->_settings->getSecurityData();
    if (isset($security['authnRequestsSigned']) && $security['authnRequestsSigned']) {
        $signature = $this->buildRequestSignature($samlRequest, $parameters['RelayState'], $security['signatureAlgorithm']);
        $parameters['SigAlg'] = $security['signatureAlgorithm'];
        $parameters['Signature'] = $signature;
    }
    return $this->redirectTo($this->getSSOurl(), $parameters, $stay);
}
@albertStaalburger
Copy link

Good day @busharthussain

Simply extend Aacotroneo\Saml2\Http\Controllers\Saml2Controller and overwrite the login function providing the desired parameters you want added.
e.g.

public function login()
{
    $returnTo = '/';
    $parameters = array(); // specify parameters here
    ...
    $this->saml2Auth->login($returnTo, $parameters, $forceAuthn, $isPassive, $stay, $setNameIdPolicy);`
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants