Package org.jboss.seam.security.external.jaxb.samlv2.protocol

Examples of org.jboss.seam.security.external.jaxb.samlv2.protocol.ObjectFactory


      X509Data.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(X509Certificate);

      KeyInfoType keyInfo = signatureFactory.createKeyInfoType();
      keyInfo.getContent().add(signatureFactory.createX509Data(X509Data));

      KeyDescriptorType keyDescriptor = metaDataFactory.createKeyDescriptorType();
      keyDescriptor.setUse(KeyTypes.SIGNING);
      keyDescriptor.setKeyInfo(keyInfo);

      ssoDescriptor.getKeyDescriptor().add(keyDescriptor);
   }
View Full Code Here


    }

    public abstract void writeMetaData(Writer writer);

    protected void addKeyDescriptorToMetaData(SSODescriptorType ssoDescriptor) {
        ObjectFactory metaDataFactory = new ObjectFactory();
        org.jboss.seam.security.external.jaxb.xmldsig.ObjectFactory signatureFactory = new org.jboss.seam.security.external.jaxb.xmldsig.ObjectFactory();

        X509Certificate certificate = getSigningKey().getCertificate();
        if (certificate == null)
            throw new RuntimeException("Certificate obtained from configuration is null");

        JAXBElement<byte[]> X509Certificate;
        try {
            X509Certificate = signatureFactory.createX509DataTypeX509Certificate(certificate.getEncoded());
        } catch (CertificateEncodingException e) {
            throw new RuntimeException(e);
        }

        X509DataType X509Data = signatureFactory.createX509DataType();
        X509Data.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(X509Certificate);

        KeyInfoType keyInfo = signatureFactory.createKeyInfoType();
        keyInfo.getContent().add(signatureFactory.createX509Data(X509Data));

        KeyDescriptorType keyDescriptor = metaDataFactory.createKeyDescriptorType();
        keyDescriptor.setUse(KeyTypes.SIGNING);
        keyDescriptor.setKeyInfo(keyInfo);

        ssoDescriptor.getKeyDescriptor().add(keyDescriptor);
    }
View Full Code Here

        ssoDescriptor.getKeyDescriptor().add(keyDescriptor);
    }

    protected void addSloEndpointsToMetaData(SSODescriptorType ssoDescriptor) {
        ObjectFactory metaDataFactory = new ObjectFactory();

        IndexedEndpointType sloRedirectEndpoint = metaDataFactory.createIndexedEndpointType();
        sloRedirectEndpoint.setBinding(SamlConstants.HTTP_REDIRECT_BINDING);
        sloRedirectEndpoint.setLocation(getServiceURL(SamlServiceType.SAML_SINGLE_LOGOUT_SERVICE));

        IndexedEndpointType sloPostEndpoint = metaDataFactory.createIndexedEndpointType();
        sloPostEndpoint.setBinding(SamlConstants.HTTP_POST_BINDING);
        sloPostEndpoint.setLocation(getServiceURL(SamlServiceType.SAML_SINGLE_LOGOUT_SERVICE));

        ssoDescriptor.getSingleLogoutService().add(sloRedirectEndpoint);
        ssoDescriptor.getSingleLogoutService().add(sloPostEndpoint);
View Full Code Here

        return null;
    }

    public void writeMetaData(Writer writer) {
        try {
            ObjectFactory metaDataFactory = new ObjectFactory();

            IndexedEndpointType acsRedirectEndpoint = metaDataFactory.createIndexedEndpointType();
            acsRedirectEndpoint.setBinding(SamlConstants.HTTP_REDIRECT_BINDING);
            acsRedirectEndpoint.setLocation(getServiceURL(SamlServiceType.SAML_ASSERTION_CONSUMER_SERVICE));

            IndexedEndpointType acsPostEndpoint = metaDataFactory.createIndexedEndpointType();
            acsPostEndpoint.setBinding(SamlConstants.HTTP_POST_BINDING);
            acsPostEndpoint.setLocation(getServiceURL(SamlServiceType.SAML_ASSERTION_CONSUMER_SERVICE));

            SPSSODescriptorType spSsoDescriptor = metaDataFactory.createSPSSODescriptorType();

            spSsoDescriptor.getAssertionConsumerService().add(acsRedirectEndpoint);
            spSsoDescriptor.getAssertionConsumerService().add(acsPostEndpoint);
            addSloEndpointsToMetaData(spSsoDescriptor);

            spSsoDescriptor.setAuthnRequestsSigned(isAuthnRequestsSigned());
            spSsoDescriptor.setWantAssertionsSigned(isWantAssertionsSigned());

            spSsoDescriptor.getProtocolSupportEnumeration().add(SamlConstants.PROTOCOL_NSURI);

            addNameIDFormatsToMetaData(spSsoDescriptor);

            if (getSigningKey() != null) {
                addKeyDescriptorToMetaData(spSsoDescriptor);
            }

            EntityDescriptorType entityDescriptor = metaDataFactory.createEntityDescriptorType();
            entityDescriptor.setEntityID(getEntityId());
            entityDescriptor.getRoleDescriptorOrIDPSSODescriptorOrSPSSODescriptor().add(spSsoDescriptor);

            Marshaller marshaller = metaDataJaxbContext.createMarshaller();
            marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
            marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
            marshaller.marshal(metaDataFactory.createEntityDescriptor(entityDescriptor), writer);
        } catch (JAXBException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

        return null;
    }

    public void writeMetaData(Writer writer) {
        try {
            ObjectFactory metaDataFactory = new ObjectFactory();

            IndexedEndpointType ssoRedirectEndpoint = metaDataFactory.createIndexedEndpointType();
            ssoRedirectEndpoint.setBinding(SamlConstants.HTTP_REDIRECT_BINDING);
            ssoRedirectEndpoint.setLocation(getServiceURL(SamlServiceType.SAML_SINGLE_SIGN_ON_SERVICE));

            IndexedEndpointType ssoPostEndpoint = metaDataFactory.createIndexedEndpointType();
            ssoPostEndpoint.setBinding(SamlConstants.HTTP_POST_BINDING);
            ssoPostEndpoint.setLocation(getServiceURL(SamlServiceType.SAML_SINGLE_SIGN_ON_SERVICE));

            IDPSSODescriptorType idpSsoDescriptor = metaDataFactory.createIDPSSODescriptorType();

            idpSsoDescriptor.getSingleSignOnService().add(ssoRedirectEndpoint);
            idpSsoDescriptor.getSingleSignOnService().add(ssoPostEndpoint);
            addSloEndpointsToMetaData(idpSsoDescriptor);

            idpSsoDescriptor.setWantAuthnRequestsSigned(isWantAuthnRequestsSigned());

            idpSsoDescriptor.getProtocolSupportEnumeration().add(SamlConstants.PROTOCOL_NSURI);

            addNameIDFormatsToMetaData(idpSsoDescriptor);

            addKeyDescriptorToMetaData(idpSsoDescriptor);

            EntityDescriptorType entityDescriptor = metaDataFactory.createEntityDescriptorType();
            entityDescriptor.setEntityID(getEntityId());
            entityDescriptor.getRoleDescriptorOrIDPSSODescriptorOrSPSSODescriptor().add(idpSsoDescriptor);

            Marshaller marshaller = metaDataJaxbContext.createMarshaller();
            marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
            marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
            marshaller.marshal(metaDataFactory.createEntityDescriptor(entityDescriptor), writer);
        } catch (JAXBException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

   public void writeMetaData(Writer writer)
   {
      try
      {
         ObjectFactory metaDataFactory = new ObjectFactory();

         IndexedEndpointType ssoRedirectEndpoint = metaDataFactory.createIndexedEndpointType();
         ssoRedirectEndpoint.setBinding(SamlConstants.HTTP_REDIRECT_BINDING);
         ssoRedirectEndpoint.setLocation(getServiceURL(SamlServiceType.SAML_SINGLE_SIGN_ON_SERVICE));

         IndexedEndpointType ssoPostEndpoint = metaDataFactory.createIndexedEndpointType();
         ssoPostEndpoint.setBinding(SamlConstants.HTTP_POST_BINDING);
         ssoPostEndpoint.setLocation(getServiceURL(SamlServiceType.SAML_SINGLE_SIGN_ON_SERVICE));

         IDPSSODescriptorType idpSsoDescriptor = metaDataFactory.createIDPSSODescriptorType();

         idpSsoDescriptor.getSingleSignOnService().add(ssoRedirectEndpoint);
         idpSsoDescriptor.getSingleSignOnService().add(ssoPostEndpoint);
         addSloEndpointsToMetaData(idpSsoDescriptor);

         idpSsoDescriptor.setWantAuthnRequestsSigned(isWantAuthnRequestsSigned());

         idpSsoDescriptor.getProtocolSupportEnumeration().add(SamlConstants.PROTOCOL_NSURI);

         addNameIDFormatsToMetaData(idpSsoDescriptor);

         addKeyDescriptorToMetaData(idpSsoDescriptor);

         EntityDescriptorType entityDescriptor = metaDataFactory.createEntityDescriptorType();
         entityDescriptor.setEntityID(getEntityId());
         entityDescriptor.getRoleDescriptorOrIDPSSODescriptorOrSPSSODescriptor().add(idpSsoDescriptor);

         Marshaller marshaller = metaDataJaxbContext.createMarshaller();
         marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
         marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
         marshaller.marshal(metaDataFactory.createEntityDescriptor(entityDescriptor), writer);
      }
      catch (JAXBException e)
      {
         throw new RuntimeException(e);
      }
View Full Code Here

   public abstract void writeMetaData(Writer writer);

   protected void addKeyDescriptorToMetaData(SSODescriptorType ssoDescriptor)
   {
      ObjectFactory metaDataFactory = new ObjectFactory();
      org.jboss.seam.security.external.jaxb.xmldsig.ObjectFactory signatureFactory = new org.jboss.seam.security.external.jaxb.xmldsig.ObjectFactory();

      X509Certificate certificate = getSigningKey().getCertificate();
      if (certificate == null)
         throw new RuntimeException("Certificate obtained from configuration is null");

      JAXBElement<byte[]> X509Certificate;
      try
      {
         X509Certificate = signatureFactory.createX509DataTypeX509Certificate(certificate.getEncoded());
      }
      catch (CertificateEncodingException e)
      {
         throw new RuntimeException(e);
      }

      X509DataType X509Data = signatureFactory.createX509DataType();
      X509Data.getX509IssuerSerialOrX509SKIOrX509SubjectName().add(X509Certificate);

      KeyInfoType keyInfo = signatureFactory.createKeyInfoType();
      keyInfo.getContent().add(signatureFactory.createX509Data(X509Data));

      KeyDescriptorType keyDescriptor = metaDataFactory.createKeyDescriptorType();
      keyDescriptor.setUse(KeyTypes.SIGNING);
      keyDescriptor.setKeyInfo(keyInfo);

      ssoDescriptor.getKeyDescriptor().add(keyDescriptor);
   }
View Full Code Here

      ssoDescriptor.getKeyDescriptor().add(keyDescriptor);
   }

   protected void addSloEndpointsToMetaData(SSODescriptorType ssoDescriptor)
   {
      ObjectFactory metaDataFactory = new ObjectFactory();

      IndexedEndpointType sloRedirectEndpoint = metaDataFactory.createIndexedEndpointType();
      sloRedirectEndpoint.setBinding(SamlConstants.HTTP_REDIRECT_BINDING);
      sloRedirectEndpoint.setLocation(getServiceURL(SamlServiceType.SAML_SINGLE_LOGOUT_SERVICE));

      IndexedEndpointType sloPostEndpoint = metaDataFactory.createIndexedEndpointType();
      sloPostEndpoint.setBinding(SamlConstants.HTTP_POST_BINDING);
      sloPostEndpoint.setLocation(getServiceURL(SamlServiceType.SAML_SINGLE_LOGOUT_SERVICE));

      ssoDescriptor.getSingleLogoutService().add(sloRedirectEndpoint);
      ssoDescriptor.getSingleLogoutService().add(sloPostEndpoint);
View Full Code Here

   public void writeMetaData(Writer writer)
   {
      try
      {
         ObjectFactory metaDataFactory = new ObjectFactory();

         IndexedEndpointType acsRedirectEndpoint = metaDataFactory.createIndexedEndpointType();
         acsRedirectEndpoint.setBinding(SamlConstants.HTTP_REDIRECT_BINDING);
         acsRedirectEndpoint.setLocation(getServiceURL(SamlServiceType.SAML_ASSERTION_CONSUMER_SERVICE));

         IndexedEndpointType acsPostEndpoint = metaDataFactory.createIndexedEndpointType();
         acsPostEndpoint.setBinding(SamlConstants.HTTP_POST_BINDING);
         acsPostEndpoint.setLocation(getServiceURL(SamlServiceType.SAML_ASSERTION_CONSUMER_SERVICE));

         SPSSODescriptorType spSsoDescriptor = metaDataFactory.createSPSSODescriptorType();

         spSsoDescriptor.getAssertionConsumerService().add(acsRedirectEndpoint);
         spSsoDescriptor.getAssertionConsumerService().add(acsPostEndpoint);
         addSloEndpointsToMetaData(spSsoDescriptor);

         spSsoDescriptor.setAuthnRequestsSigned(isAuthnRequestsSigned());
         spSsoDescriptor.setWantAssertionsSigned(isWantAssertionsSigned());

         spSsoDescriptor.getProtocolSupportEnumeration().add(SamlConstants.PROTOCOL_NSURI);

         addNameIDFormatsToMetaData(spSsoDescriptor);

         if (getSigningKey() != null)
         {
            addKeyDescriptorToMetaData(spSsoDescriptor);
         }

         EntityDescriptorType entityDescriptor = metaDataFactory.createEntityDescriptorType();
         entityDescriptor.setEntityID(getEntityId());
         entityDescriptor.getRoleDescriptorOrIDPSSODescriptorOrSPSSODescriptor().add(spSsoDescriptor);

         Marshaller marshaller = metaDataJaxbContext.createMarshaller();
         marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
         marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
         marshaller.marshal(metaDataFactory.createEntityDescriptor(entityDescriptor), writer);
      }
      catch (JAXBException e)
      {
         throw new RuntimeException(e);
      }
View Full Code Here

            IndexedEndpointType acsPostEndpoint = metaDataFactory.createIndexedEndpointType();
            acsPostEndpoint.setBinding(SamlConstants.HTTP_POST_BINDING);
            acsPostEndpoint.setLocation(getServiceURL(SamlServiceType.SAML_ASSERTION_CONSUMER_SERVICE));

            SPSSODescriptorType spSsoDescriptor = metaDataFactory.createSPSSODescriptorType();

            spSsoDescriptor.getAssertionConsumerService().add(acsRedirectEndpoint);
            spSsoDescriptor.getAssertionConsumerService().add(acsPostEndpoint);
            addSloEndpointsToMetaData(spSsoDescriptor);

            spSsoDescriptor.setAuthnRequestsSigned(isAuthnRequestsSigned());
            spSsoDescriptor.setWantAssertionsSigned(isWantAssertionsSigned());

            spSsoDescriptor.getProtocolSupportEnumeration().add(SamlConstants.PROTOCOL_NSURI);

            addNameIDFormatsToMetaData(spSsoDescriptor);

            if (getSigningKey() != null) {
                addKeyDescriptorToMetaData(spSsoDescriptor);
View Full Code Here

TOP

Related Classes of org.jboss.seam.security.external.jaxb.samlv2.protocol.ObjectFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.