SamlRedirectUtils { public static String getIdpRedirectUrl(SamlIdentityProviderDefinition definition, String entityId, IdentityZone identityZone) { UriComponentsBuilder builder = UriComponentsBuilder.fromPath("saml/discovery"); builder.queryParam("returnIDParam", "idp"); builder.queryParam("entityID", getZonifiedEntityId(entityId, identityZone)); builder.queryParam("idp", definition.getIdpEntityAlias()); builder.queryParam("isPassive", "true"); return builder.build().toUriString(); }  static String getIdpRedirectUrl(SamlIdentityProviderDefinition definition, String entityId, IdentityZone identityZone); static String getZonifiedEntityId(String entityID, IdentityZone identityZone); static Response wrapAssertionIntoResponse(Assertion assertion, String assertionIssuer);  }
@Test public void testGetIdpRedirectUrl() { SamlIdentityProviderDefinition definition = new SamlIdentityProviderDefinition() .setMetaDataLocation("http: .setIdpEntityAlias("simplesamlphp-url") .setNameID("nameID") .setMetadataTrustCheck(true) .setLinkText("link text") .setZoneId(IdentityZone.getUaaZoneId()); String domain = "login.random-made-up-url.com"; String url = SamlRedirectUtils.getIdpRedirectUrl(definition, domain, IdentityZoneHolder.get()); Assert.assertEquals("saml/discovery?returnIDParam=idp&entityID=" + domain + "&idp=simplesamlphp-url&isPassive=true", url); }