43 SamlClient samlClient =
new SamlClient(client);
44 ByteArrayOutputStream baos =
new ByteArrayOutputStream();
45 ZipOutputStream zip =
new ZipOutputStream(baos);
46 String idpDescriptor = SamlIDPDescriptorClientInstallation.getIDPDescriptorForClient(session, realm, client, serverBaseUri);
47 String spDescriptor = SamlSPDescriptorClientInstallation.getSPDescriptorForClient(client);
48 String clientDirName = client.getClientId()
52 zip.putNextEntry(
new ZipEntry(clientDirName +
"/idp-metadata.xml"));
53 zip.write(idpDescriptor.getBytes());
55 zip.putNextEntry(
new ZipEntry(clientDirName +
"/sp-metadata.xml"));
56 zip.write(spDescriptor.getBytes());
58 if (samlClient.requiresClientSignature()) {
59 if (samlClient.getClientSigningPrivateKey() != null) {
60 zip.putNextEntry(
new ZipEntry(clientDirName +
"/client-private-key.pem"));
61 zip.write(samlClient.getClientSigningPrivateKey().getBytes());
64 if (samlClient.getClientSigningCertificate() != null) {
65 zip.putNextEntry(
new ZipEntry(clientDirName +
"/client-cert.pem"));
66 zip.write(samlClient.getClientSigningCertificate().getBytes());
72 }
catch (IOException e) {
73 throw new RuntimeException(e);
77 return Response.ok(baos.toByteArray(),
getMediaType()).build();
String getMediaType()
Definition: ModAuthMellonClientInstallation.java:101