Examples of IDPSSODescriptor


Examples of org.opensaml.saml2.metadata.IDPSSODescriptor

*/
public class IDPSSODescriptorUnmarshaller extends SSODescriptorUnmarshaller {

    /** {@inheritDoc} */
    protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException {
        IDPSSODescriptor descriptor = (IDPSSODescriptor) parentObject;

        if (childObject instanceof SingleSignOnService) {
            descriptor.getSingleSignOnServices().add((SingleSignOnService) childObject);
        } else if (childObject instanceof NameIDMappingService) {
            descriptor.getNameIDMappingServices().add((NameIDMappingService) childObject);
        } else if (childObject instanceof AssertionIDRequestService) {
            descriptor.getAssertionIDRequestServices().add((AssertionIDRequestService) childObject);
        } else if (childObject instanceof AttributeProfile) {
            descriptor.getAttributeProfiles().add((AttributeProfile) childObject);
        } else if (childObject instanceof Attribute) {
            descriptor.getAttributes().add((Attribute) childObject);
        } else {
            super.processChildElement(parentObject, childObject);
        }
    }
View Full Code Here

Examples of org.opensaml.saml2.metadata.IDPSSODescriptor

        }
    }

    /** {@inheritDoc} */
    protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
        IDPSSODescriptor descriptor = (IDPSSODescriptor) samlObject;

        if (attribute.getLocalName().equals(IDPSSODescriptor.WANT_AUTHN_REQ_SIGNED_ATTRIB_NAME)) {
            descriptor.setWantAuthnRequestsSigned(XSBooleanValue.valueOf(attribute.getValue()));
        } else {
            super.processAttribute(samlObject, attribute);
        }
    }
View Full Code Here

Examples of org.opensaml.saml2.metadata.IDPSSODescriptor

*/
public class IDPSSODescriptorMarshaller extends SSODescriptorMarshaller {

    /** {@inheritDoc} */
    protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
        IDPSSODescriptor descriptor = (IDPSSODescriptor) samlObject;

        if (descriptor.getWantAuthnRequestsSignedXSBoolean() != null) {
            domElement.setAttributeNS(null, IDPSSODescriptor.WANT_AUTHN_REQ_SIGNED_ATTRIB_NAME, descriptor
                    .getWantAuthnRequestsSignedXSBoolean().toString());
        }

        super.marshallAttributes(samlObject, domElement);
    }
View Full Code Here

Examples of org.opensaml.saml2.metadata.IDPSSODescriptor

    @SuppressWarnings("unchecked")
    public void sendMessage(final SAMLMessageContext context, final AuthnRequest authnRequest, final String relayState) {

        SPSSODescriptor spDescriptor = (SPSSODescriptor) context.getLocalEntityRoleMetadata();
        IDPSSODescriptor idpssoDescriptor = (IDPSSODescriptor) context.getPeerEntityRoleMetadata();
        SingleSignOnService ssoService = SamlUtils.getSingleSignOnService(idpssoDescriptor, destinationBindingType);

        context.setCommunicationProfileId(SAML2_WEBSSO_PROFILE_URI);
        context.setOutboundMessage(authnRequest);
        context.setOutboundSAMLMessage(authnRequest);
        context.setPeerEntityEndpoint(ssoService);

        if (relayState != null) {
            context.setRelayState(relayState);
        }

        if (spDescriptor.isAuthnRequestsSigned()) {
            context.setOutboundSAMLMessageSigningCredential(credentialProvider.getCredential());
        } else if (idpssoDescriptor.getWantAuthnRequestsSigned()) {
            logger.warn("IdP wants authn requests signed, it will perhaps reject your authn requests unless you provide a keystore");
        }

        try {
            encoder.encode(context);
View Full Code Here

Examples of org.opensaml.saml2.metadata.IDPSSODescriptor

    private final XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();

    public AuthnRequest build(final SAMLMessageContext context) {

        SPSSODescriptor spDescriptor = (SPSSODescriptor) context.getLocalEntityRoleMetadata();
        IDPSSODescriptor idpssoDescriptor = (IDPSSODescriptor) context.getPeerEntityRoleMetadata();

        SingleSignOnService ssoService = SamlUtils.getSingleSignOnService(idpssoDescriptor, bindingType);
        AssertionConsumerService assertionConsumerService = SamlUtils.getAssertionConsumerService(spDescriptor, null);

        return buildAuthnRequest(context, assertionConsumerService, ssoService);
View Full Code Here

Examples of org.opensaml.saml2.metadata.IDPSSODescriptor

        // If no user is logged in we do not initialize the protocol.
        if (credential == null) {
            return;
        }

        IDPSSODescriptor idpDescriptor = (IDPSSODescriptor) context.getPeerEntityRoleMetadata();
        SPSSODescriptor spDescriptor = (SPSSODescriptor) context.getLocalEntityRoleMetadata();
        String binding = SAMLUtil.getLogoutBinding(idpDescriptor, spDescriptor);

        SingleLogoutService logoutServiceIDP = SAMLUtil.getLogoutServiceForBinding(idpDescriptor, binding);
        LogoutRequest logoutRequest = getLogoutRequest(context, credential, logoutServiceIDP);
View Full Code Here

Examples of org.opensaml.saml2.metadata.IDPSSODescriptor

    public void sendLogoutResponse(SAMLMessageContext context, String statusCode, String statusMessage) throws MetadataProviderException, SAMLException, MessageEncodingException {

        SAMLObjectBuilder<LogoutResponse> responseBuilder = (SAMLObjectBuilder<LogoutResponse>) builderFactory.getBuilder(LogoutResponse.DEFAULT_ELEMENT_NAME);
        LogoutResponse logoutResponse = responseBuilder.buildObject();

        IDPSSODescriptor idpDescriptor = SAMLUtil.getIDPDescriptor(metadata, context.getPeerEntityId());
        SPSSODescriptor spDescriptor = (SPSSODescriptor) context.getLocalEntityRoleMetadata();
        String binding = SAMLUtil.getLogoutBinding(idpDescriptor, spDescriptor);
        SingleLogoutService logoutService = SAMLUtil.getLogoutServiceForBinding(idpDescriptor, binding);

        logoutResponse.setID(generateID());
        logoutResponse.setIssuer(getIssuer(context.getLocalEntityId()));
        logoutResponse.setVersion(SAMLVersion.VERSION_20);
        logoutResponse.setIssueInstant(new DateTime());
        logoutResponse.setInResponseTo(context.getInboundSAMLMessageId());
        logoutResponse.setDestination(logoutService.getLocation());

        Status status = getStatus(statusCode, statusMessage);
        logoutResponse.setStatus(status);

        context.setCommunicationProfileId(getProfileIdentifier());
        context.setOutboundMessage(logoutResponse);
        context.setOutboundSAMLMessage(logoutResponse);
        context.setPeerEntityEndpoint(logoutService);

        context.setPeerEntityId(idpDescriptor.getID());
        context.setPeerEntityRoleMetadata(idpDescriptor);

        boolean signMessage = context.getPeerExtendedMetadata().isRequireLogoutResponseSigned();
        sendMessage(context, signMessage);
View Full Code Here

Examples of org.opensaml.saml2.metadata.IDPSSODescriptor

            throw new SAMLException("WebSSO can only be initialized for local SP, but localEntityRole is: " + context.getLocalEntityRole());
        }

        // Load the entities from the context
        SPSSODescriptor spDescriptor = (SPSSODescriptor) context.getLocalEntityRoleMetadata();
        IDPSSODescriptor idpssoDescriptor = (IDPSSODescriptor) context.getPeerEntityRoleMetadata();
        ExtendedMetadata idpExtendedMetadata = context.getPeerExtendedMetadata();

        if (spDescriptor == null || idpssoDescriptor == null || idpExtendedMetadata == null) {
            throw new SAMLException("SPSSODescriptor, IDPSSODescriptor or IDPExtendedMetadata are not present in the SAMLContext");
        }

        SingleSignOnService ssoService = getSingleSignOnService(options, idpssoDescriptor, spDescriptor);
        AssertionConsumerService consumerService = getAssertionConsumerService(options, idpssoDescriptor, spDescriptor);
        AuthnRequest authRequest = getAuthnRequest(context, options, consumerService, ssoService);

        // TODO optionally implement support for conditions, subject

        context.setCommunicationProfileId(getProfileIdentifier());
        context.setOutboundMessage(authRequest);
        context.setOutboundSAMLMessage(authRequest);
        context.setPeerEntityEndpoint(ssoService);
        context.setPeerEntityRoleMetadata(idpssoDescriptor);
        context.setPeerExtendedMetadata(idpExtendedMetadata);

        if (options.getRelayState() != null) {
            context.setRelayState(options.getRelayState());
        }

        boolean sign = spDescriptor.isAuthnRequestsSigned() || idpssoDescriptor.getWantAuthnRequestsSigned();
        sendMessage(context, sign);

        SAMLMessageStorage messageStorage = context.getMessageStorage();
        if (messageStorage != null) {
            messageStorage.storeMessage(authRequest.getID(), authRequest);
View Full Code Here

Examples of org.opensaml.saml2.metadata.IDPSSODescriptor

            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);

            getArtifactResponse(endpointURI, context);
View Full Code Here

Examples of org.opensaml.saml2.metadata.IDPSSODescriptor

        super(namespaceURI, elementLocalName);
    }

    /** {@inheritDoc} */
    protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
        IDPSSODescriptor descriptor = (IDPSSODescriptor) samlObject;

        if (descriptor.getWantAuthnRequestsSignedXSBoolean() != null) {
            domElement.setAttributeNS(null, IDPSSODescriptor.WANT_AUTHN_REQ_SIGNED_ATTRIB_NAME,
                    descriptor.getWantAuthnRequestsSignedXSBoolean().toString());
        }

        super.marshallAttributes(samlObject, domElement);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.