Package org.opensaml.saml2.metadata

Examples of org.opensaml.saml2.metadata.EntityDescriptor


    protected void addIDPContext(final BasicSAMLMessageContext context) {

        context.setPeerEntityId(this.idpEntityId);
        context.setPeerEntityRole(IDPSSODescriptor.DEFAULT_ELEMENT_NAME);

        EntityDescriptor entityDescriptor = null;
        RoleDescriptor roleDescriptor = null;
        try {
            entityDescriptor = this.metadata.getEntityDescriptor(this.idpEntityId);
            roleDescriptor = this.metadata.getRole(this.idpEntityId, IDPSSODescriptor.DEFAULT_ELEMENT_NAME,
                    SAMLConstants.SAML20P_NS);
View Full Code Here


    protected boolean wantAssertionSigned = true;

    protected int defaultACSIndex = 0;

    public AbstractMetadataProvider buildMetadataProvider() {
        final EntityDescriptor md = buildMetadata();
        return new AbstractMetadataProvider() {

            @Override
            protected XMLObject doGetMetadata() throws MetadataProviderException {
                return md;
View Full Code Here

            }
        };
    }

    public String printMetadata() throws MarshallingException {
        EntityDescriptor md = buildMetadata();
        Element entityDescriptorElement = this.marshallerFactory.getMarshaller(md).marshall(md);
        return XMLHelper.nodeToString(entityDescriptorElement);
    }
View Full Code Here

    public EntityDescriptor buildMetadata() {

        SAMLObjectBuilder<EntityDescriptor> builder = (SAMLObjectBuilder<EntityDescriptor>) this.builderFactory
                .getBuilder(EntityDescriptor.DEFAULT_ELEMENT_NAME);
        EntityDescriptor descriptor = builder.buildObject();
        descriptor.setEntityID(this.entityId);
        descriptor.getRoleDescriptors().add(buildSPSSODescriptor());

        return descriptor;

    }
View Full Code Here

            // Endpoint index.
            int endpointIndex = parseEndpointIndex(decodedArtifact.getEndpointIndex());

            // Locate sender using the artifact sourceID
            EntityDescriptor idpEntityDescriptor = metadata.getEntityDescriptor(decodedArtifact.getSourceID());

            if (idpEntityDescriptor == null) {
                throw new MetadataProviderException("Cannot localize sender entity by SHA-1 hash from the artifact");
            }

            ExtendedMetadata extendedMetadata = metadata.getExtendedMetadata(idpEntityDescriptor.getEntityID());
            IDPSSODescriptor idpssoDescriptor = SAMLUtil.getIDPSSODescriptor(idpEntityDescriptor);
            ArtifactResolutionService artifactResolutionService = SAMLUtil.getArtifactResolutionService(idpssoDescriptor, endpointIndex);

            // Create SAML message for artifact resolution
            ArtifactResolve artifactResolve = createArtifactResolve(context, artifactId, artifactResolutionService);

            context.setCommunicationProfileId(getProfileIdentifier());
            context.setInboundSAMLBinding(artifactResolutionService.getBinding());
            context.setOutboundMessage(artifactResolve);
            context.setOutboundSAMLMessage(artifactResolve);
            context.setPeerEntityEndpoint(artifactResolutionService);
            context.setPeerEntityId(idpEntityDescriptor.getEntityID());
            context.setPeerEntityMetadata(idpEntityDescriptor);
            context.setPeerEntityRole(idpssoDescriptor.getElementQName());
            context.setPeerEntityRoleMetadata(idpssoDescriptor);
            context.setPeerExtendedMetadata(extendedMetadata);
View Full Code Here

        if (hasLength(metadata.getSigningAlgorithm())) {
            extendedMetadata.setSigningAlgorithm(metadata.getSigningAlgorithm());
        }

        // Generate values
        EntityDescriptor generatedDescriptor = generator.generateMetadata();
        ExtendedMetadata generatedExtendedMetadata = generator.generateExtendedMetadata();

        if (metadata.isStore()) {

            MetadataMemoryProvider memoryProvider = new MetadataMemoryProvider(generatedDescriptor);
            memoryProvider.initialize();
            MetadataProvider metadataProvider = new ExtendedMetadataDelegate(memoryProvider, generatedExtendedMetadata);
            metadataManager.addMetadataProvider(metadataProvider);
            metadataManager.setHostedSPName(generatedDescriptor.getEntityID());
            metadataManager.setRefreshRequired(true);
            metadataManager.refreshMetadata();

        }
View Full Code Here

     * @throws MarshallingException      in case de-serialization into string fails
     */
    @RequestMapping(value = "/display")
    public ModelAndView displayMetadata(@RequestParam("entityId") String entityId) throws MetadataProviderException, MarshallingException {

        EntityDescriptor entityDescriptor = metadataManager.getEntityDescriptor(entityId);
        ExtendedMetadata extendedMetadata = metadataManager.getExtendedMetadata(entityId);

        if (entityDescriptor == null) {
            throw new MetadataProviderException("Metadata with ID " + entityId + " not found");
        }
View Full Code Here

            errors.rejectValue("nameID", null, "At least one NameID must be selected.");
        }

        try {
            if (!errors.hasErrors() && metadata.isStore()) {
                EntityDescriptor entityDescriptor = manager.getEntityDescriptor(metadata.getEntityId());
                if (entityDescriptor != null) {
                    errors.rejectValue("entityId", null, "Selected entity ID is already used.");
                }
                String idForAlias = manager.getEntityIdForAlias(metadata.getAlias());
                if (idForAlias != null) {
View Full Code Here

     * @return extended metadata or null in case no default is given and entity can be located or is not present in the delegate
     * @throws MetadataProviderException error
     */
    public ExtendedMetadata getExtendedMetadata(String entityID) throws MetadataProviderException {

        EntityDescriptor entityDescriptor = getEntityDescriptor(entityID);
        if (entityDescriptor == null) {
            return null;
        }

        ExtendedMetadata extendedMetadata = null;
View Full Code Here

        super(targetNamespaceURI, targetLocalName);
    }

    /** {@inheritDoc} */
    protected void marshallAttributes(XMLObject samlElement, Element domElement) {
        EntityDescriptor entityDescriptor = (EntityDescriptor) samlElement;

        // Set the entityID attribute
        if (entityDescriptor.getEntityID() != null) {
            domElement.setAttributeNS(null, EntityDescriptor.ENTITY_ID_ATTRIB_NAME, entityDescriptor.getEntityID());
        }

        // Set the ID attribute
        if (entityDescriptor.getID() != null) {
            domElement.setAttributeNS(null, EntityDescriptor.ID_ATTRIB_NAME, entityDescriptor.getID());
            domElement.setIdAttributeNS(null, EntityDescriptor.ID_ATTRIB_NAME, true);
        }

        // Set the validUntil attribute
        if (entityDescriptor.getValidUntil() != null) {
            log.debug("Writting validUntil attribute to EntityDescriptor DOM element");
            String validUntilStr = Configuration.getSAMLDateFormatter().print(entityDescriptor.getValidUntil());
            domElement.setAttributeNS(null, TimeBoundSAMLObject.VALID_UNTIL_ATTRIB_NAME, validUntilStr);
        }

        // Set the cacheDuration attribute
        if (entityDescriptor.getCacheDuration() != null) {
            log.debug("Writting cacheDuration attribute to EntityDescriptor DOM element");
            String cacheDuration = XMLHelper.longToDuration(entityDescriptor.getCacheDuration());
            domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME, cacheDuration);
        }

        Attr attribute;
        for (Entry<QName, String> entry : entityDescriptor.getUnknownAttributes().entrySet()) {
            attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey());
            attribute.setValue(entry.getValue());
            domElement.setAttributeNodeNS(attribute);
            if (Configuration.isIDAttribute(entry.getKey())
                    || entityDescriptor.getUnknownAttributes().isIDAttribute(entry.getKey())) {
                attribute.getOwnerElement().setIdAttributeNode(attribute, true);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.opensaml.saml2.metadata.EntityDescriptor

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.