random42 / passport-spid

Passport strategy for SPID (italian citizens) authentication
MIT License
11 stars 5 forks source link

fix issue #10 pass RelayState down to additionalParams #11

Closed fautore closed 3 weeks ago

fautore commented 3 weeks ago

fix issue #10. The main idea is to enable the ability for the user to pass RelayState when building the strategy:

// configuration code ...
    saml: {
      authnRequestBinding: 'HTTP-POST', // or HTTP-Redirect
      attributeConsumingServiceIndex: '0', // index of 'acs' array
      signatureAlgorithm: 'sha256',
      digestAlgorithm: 'sha256',
      callbackUrl: spCallbackUrl,
      logoutCallbackUrl: spLogoutCallbackUrl,
      racComparison: 'minimum',
      privateKey,
      audience: sp,
      additionalParams: { // pass relaystate to additionalParams
        RelayState: 'send test relay state'
      }
    },
// configuration code ...

and then access it via:

console.log(req.body.RelayState); 
// OUTPUT:
// send test relay state

if no RelayState is provided, the default is used. I ran the tests, all checks pass, thank you.

random42 commented 3 weeks ago

LGTM