@SuppressWarnings("unchecked") @Test public void getMetadataTest() { Response response = resource.getMetadata(); Assert.assertNotNull(response); Assert.assertEquals(Status.OK.getStatusCode(), response.getStatus()); Assert.assertNotNull(response.getEntity()); Exception exception = null; try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(new StringReader((String) response.getEntity())); org.w3c.dom.Document doc = db.parse(is); DOMBuilder builder = new DOMBuilder(); org.jdom.Document jdomDocument = builder.build(doc); Iterator<org.jdom.Element> itr = jdomDocument.getDescendants(new ElementFilter()); while (itr.hasNext()) { org.jdom.Element el = itr.next(); if(el.getName().equals("X509Certificate")) { Assert.assertNotNull(el.getText()); } } } catch (ParserConfigurationException e) { exception = e; } catch (SAXException e) { exception = e; } catch (IOException e) { exception = e; } Assert.assertNull(exception); }
@GET @Path("metadata") @Produces({ "text/xml" }) public Response getMetadata() { if (!metadata.isEmpty()) { return Response.ok(metadata).build(); } return Response.status(Response.Status.NOT_FOUND).build(); }
SamlFederationResource { @GET @Path("metadata") @Produces({ "text/xml" }) public Response getMetadata() { if (!metadata.isEmpty()) { return Response.ok(metadata).build(); } return Response.status(Response.Status.NOT_FOUND).build(); } }
SamlFederationResource { @GET @Path("metadata") @Produces({ "text/xml" }) public Response getMetadata() { if (!metadata.isEmpty()) { return Response.ok(metadata).build(); } return Response.status(Response.Status.NOT_FOUND).build(); }  }
SamlFederationResource { @GET @Path("metadata") @Produces({ "text/xml" }) public Response getMetadata() { if (!metadata.isEmpty()) { return Response.ok(metadata).build(); } return Response.status(Response.Status.NOT_FOUND).build(); }  @GET @Path("metadata") @Produces({ "text/xml" }) Response getMetadata(); @POST @Path("sso/post") Response processPostBinding(@FormParam("SAMLResponse") String postData, @Context UriInfo uriInfo); @GET @Path("sso/artifact") Response processArtifactBinding(@Context HttpServletRequest request, @Context UriInfo uriInfo); }
SamlFederationResource { @GET @Path("metadata") @Produces({ "text/xml" }) public Response getMetadata() { if (!metadata.isEmpty()) { return Response.ok(metadata).build(); } return Response.status(Response.Status.NOT_FOUND).build(); }  @GET @Path("metadata") @Produces({ "text/xml" }) Response getMetadata(); @POST @Path("sso/post") Response processPostBinding(@FormParam("SAMLResponse") String postData, @Context UriInfo uriInfo); @GET @Path("sso/artifact") Response processArtifactBinding(@Context HttpServletRequest request, @Context UriInfo uriInfo); static SimpleDateFormat ft; }