public static void uploadSP() { try { Keycloak keycloak = Keycloak.getInstance( "http://localhost:8081/auth", "master", "admin", "admin", Constants.ADMIN_CLI_CLIENT_ID, null); RealmResource admin = keycloak.realm("demo"); admin.toRepresentation(); ClientRepresentation clientRep = admin.convertClientDescription( IOUtils.toString( SamlPicketlinkSPTest.class.getResourceAsStream("/saml/sp-metadata.xml"))); Response response = admin.clients().create(clientRep); assertEquals(201, response.getStatus()); keycloak.close(); } catch (IOException e) { throw new RuntimeException(e); } }
public static void uploadSP(String AUTH_SERVER_URL) { try { Keycloak keycloak = Keycloak.getInstance( AUTH_SERVER_URL, "master", "admin", "admin", Constants.ADMIN_CLI_CLIENT_ID, null); RealmResource admin = keycloak.realm("demo"); admin.toRepresentation(); ClientRepresentation clientRep = admin.convertClientDescription( IOUtils.toString( SamlAdapterTestStrategy.class.getResourceAsStream( "/keycloak-saml/sp-metadata.xml"))); Response response = admin.clients().create(clientRep); assertEquals(201, response.getStatus()); keycloak.close(); } catch (IOException e) { throw new RuntimeException(e); } }