Search in sources :

Example 1 with EntityDescriptorDocument

use of xmlbeans.org.oasis.saml2.metadata.EntityDescriptorDocument in project unity by unity-idm.

the class MetadataVerificator method validateSingle.

protected void validateSingle(EntityDescriptorType meta, Date now, MetadataSignatureValidation sigValidation, X509Certificate issuerCertificate) throws MetadataValidationException {
    if (meta.isSetValidUntil() && meta.getValidUntil().after(now))
        throw new MetadataValidationException("Metadata or its part expired on " + meta.getValidUntil());
    if (sigValidation == MetadataSignatureValidation.require) {
        EntityDescriptorDocument tmp = EntityDescriptorDocument.Factory.newInstance();
        tmp.setEntityDescriptor(meta);
        validateSignature(issuerCertificate, meta.getEntityID(), (Document) tmp.getDomNode());
    }
}
Also used : EntityDescriptorDocument(xmlbeans.org.oasis.saml2.metadata.EntityDescriptorDocument)

Example 2 with EntityDescriptorDocument

use of xmlbeans.org.oasis.saml2.metadata.EntityDescriptorDocument in project unity by unity-idm.

the class MetadataServlet method serveMetadata.

protected void serveMetadata(MetadataProvider metaProvider, HttpServletRequest req, HttpServletResponse resp) throws IOException {
    resp.setContentType("application/samlmetadata+xml");
    EntityDescriptorDocument meta;
    try {
        meta = metaProvider.getMetadata();
    } catch (Exception e) {
        log.error("Problem generating SAML metadata document.", e);
        resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Problem occured when generating metadata.");
        return;
    }
    PrintWriter writer = resp.getWriter();
    writer.write(meta.xmlText());
    writer.flush();
}
Also used : EntityDescriptorDocument(xmlbeans.org.oasis.saml2.metadata.EntityDescriptorDocument) ServletException(javax.servlet.ServletException) IOException(java.io.IOException) PrintWriter(java.io.PrintWriter)

Aggregations

EntityDescriptorDocument (xmlbeans.org.oasis.saml2.metadata.EntityDescriptorDocument)2 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 ServletException (javax.servlet.ServletException)1