Skip to content

Allow authn request without relayState if relayState is empty#82

Merged
pitbulk merged 1 commit intoSAML-Toolkits:v2.0.0from
ThePetrov:allow-authn-request-without-relaystate
Nov 6, 2016
Merged

Allow authn request without relayState if relayState is empty#82
pitbulk merged 1 commit intoSAML-Toolkits:v2.0.0from
ThePetrov:allow-authn-request-without-relaystate

Conversation

@ThePetrov
Copy link
Copy Markdown
Contributor

Currently it's not possible to have an authn request without a relayState. When a null relayState is provided, then a self routed URL is used instead. If an empty string is provided, then relayState is appended as a query parameter without value. A request without a relayState is a valid case and relayState without value does not work ie in ADFS (it results in an MSIS7000 error).

To mitigate this without changing the API too much I've changed login to treat an empty returnTo (relayState) parameter as no relay state. A null returnTo will still result in a self routed URL. I also added a test case for this scenario and extended the Javadocs to inform about the behavior.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.002%) to 96.59% when pulling 9a4ad27 on ThePetrov:allow-authn-request-without-relaystate into 3fcda2c on onelogin:v2.0.0.

@pitbulk
Copy link
Copy Markdown
Contributor

pitbulk commented Sep 22, 2016

I think is an acceptable behavior, but let me review rest of the toolkits and also review how this affect to the signature process before merge. (also we should extend that for the LogoutRequest).

@ThePetrov
Copy link
Copy Markdown
Contributor Author

Alright, thanks for the feedback @pitbulk . I've changed the logout method so that it uses the same behavior.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.003%) to 96.592% when pulling 560e3e2 on ThePetrov:allow-authn-request-without-relaystate into 3fcda2c on onelogin:v2.0.0.

@ThePetrov ThePetrov force-pushed the allow-authn-request-without-relaystate branch 2 times, most recently from cc94aba to 84df311 Compare September 26, 2016 11:33
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.003%) to 96.592% when pulling 84df311 on ThePetrov:allow-authn-request-without-relaystate into 3fcda2c on onelogin:v2.0.0.

@miszobi
Copy link
Copy Markdown
Contributor

miszobi commented Oct 4, 2016

@pitbulk anything left to be done here before merging?

@pitbulk
Copy link
Copy Markdown
Contributor

pitbulk commented Oct 4, 2016

No sorry, I was on vacation mode. I will review it again in a couple of hours and merge it.

@miszobi
Copy link
Copy Markdown
Contributor

miszobi commented Oct 4, 2016

No worries, thanks!

@pitbulk
Copy link
Copy Markdown
Contributor

pitbulk commented Oct 4, 2016

If we don't add a GET['RelayState'] parameter if relayState var is empty, we should update the buildSignature method, and don't calculate the signature based on the relayState.

currently we only check that is not null

if (relayState != null) {
    msg += "&RelayState=" + Util.urlEncoder(relayState);
}

The specs says:

if there is no RelayState value, the entire parameter should be omitted from the signature
computation (and not included as an empty parameter name), resulting in a string of one
of these

SAMLRequest=value&SigAlg=value
SAMLResponse=value&SigAlg=value

@ThePetrov can you fix that?

@pitbulk
Copy link
Copy Markdown
Contributor

pitbulk commented Oct 25, 2016

@ThePetrov any chance to update the PR with my suggestions and rebase?

- add handling for empty relayState
- add test for login and SLO without relayState
- extend Javadocs with information about the new behavior
- change signature building for empty relaystate
@ThePetrov ThePetrov force-pushed the allow-authn-request-without-relaystate branch from 84df311 to e0eeb43 Compare November 4, 2016 11:21
@ThePetrov
Copy link
Copy Markdown
Contributor Author

@pitbulk - sorry for the delay, I updated the signature building and added tests for it

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.003%) to 96.639% when pulling e0eeb43 on ThePetrov:allow-authn-request-without-relaystate into cca5d21 on onelogin:v2.0.0.

@pitbulk pitbulk merged commit 421341a into SAML-Toolkits:v2.0.0 Nov 6, 2016
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

Successfully merging this pull request may close these issues.

4 participants