idp initiated relaystate query param

This commit is contained in:
Bill Burke 2015-07-16 08:48:07 -04:00
parent 5a9badf683
commit 808d27be2d
2 changed files with 7 additions and 3 deletions

View file

@ -194,7 +194,8 @@
with no whitespace in it. After this you can reference your client at the following URL: <literal>root/auth/realms/{realm}/protocol/saml/clients/{url-name}</literal>
</para>
<para>
If your client requires a special relay state, you can also configure this in the admin console.
If your client requires a special relay state, you can also configure this in the admin console. Alternatively, you can specify the relay state in a
<literal>RelayState</literal> query parameter, i.e. : <literal>root/auth/realms/{realm}/protocol/saml/clients/{url-name}?RelayState=thestate</literal>
</para>
</section>
</chapter>

View file

@ -561,7 +561,8 @@ public class SamlService {
@GET
@Path("clients/{client}")
@Produces(MediaType.TEXT_HTML)
public Response idpInitiatedSSO(@PathParam("client") String clientUrlName) {
public Response idpInitiatedSSO(@PathParam("client") String clientUrlName,
@QueryParam("RelayState") String relayState) {
event.event(EventType.LOGIN);
ClientModel client = null;
for (ClientModel c : realm.getClients()) {
@ -609,7 +610,9 @@ public class SamlService {
clientSession.setNote(SamlProtocol.SAML_IDP_INITIATED_LOGIN, "true");
clientSession.setRedirectUri(redirect);
String relayState = client.getAttribute(SamlProtocol.SAML_IDP_INITIATED_SSO_RELAY_STATE);
if (relayState == null) {
relayState = client.getAttribute(SamlProtocol.SAML_IDP_INITIATED_SSO_RELAY_STATE);
}
if (relayState != null && !relayState.trim().equals("")) {
clientSession.setNote(GeneralConstants.RELAY_STATE, relayState);
}