當前位置: 首頁>>代碼示例>>Java>>正文


Java SAMLBindingContext類代碼示例

本文整理匯總了Java中org.opensaml.saml.common.messaging.context.SAMLBindingContext的典型用法代碼示例。如果您正苦於以下問題:Java SAMLBindingContext類的具體用法?Java SAMLBindingContext怎麽用?Java SAMLBindingContext使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SAMLBindingContext類屬於org.opensaml.saml.common.messaging.context包,在下文中一共展示了SAMLBindingContext類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doExecute

import org.opensaml.saml.common.messaging.context.SAMLBindingContext; //導入依賴的package包/類
@Nonnull
@Override
protected Event doExecute(
        final @Nonnull RequestContext springRequestContext,
        final @Nonnull ProfileRequestContext<SAMLObject, SAMLObject> profileRequestContext) {

    final MessageContext<SAMLObject> msgContext = new MessageContext<>();
    try {
        msgContext.setMessage(buildSamlResponse(springRequestContext, profileRequestContext));
    } catch (IllegalStateException e) {
        return ProtocolError.IllegalState.event(this);
    }
    final SAMLBindingContext bindingContext = new SAMLBindingContext();
    bindingContext.setBindingUri(SAMLConstants.SAML1_SOAP11_BINDING_URI);
    msgContext.addSubcontext(bindingContext);
    profileRequestContext.setOutboundMessageContext(msgContext);

    // Return null to signal that other actions must follow this one before proceeding to next state
    return null;
}
 
開發者ID:serac,項目名稱:shibboleth-idp-ext-cas,代碼行數:21,代碼來源:AbstractOutgoingSamlMessageAction.java

示例2: populateBindingContext

import org.opensaml.saml.common.messaging.context.SAMLBindingContext; //導入依賴的package包/類
/**
 * Populate the context which carries information specific to this binding.
 *
 * @param messageContext the current message context
 */
protected void populateBindingContext(MessageContext<SAMLObject> messageContext) {
    SAMLBindingContext bindingContext = messageContext.getSubcontext(SAMLBindingContext.class, true);
    bindingContext.setBindingUri(getBindingURI());
    bindingContext.setHasBindingSignature(false);
    bindingContext.setIntendedDestinationEndpointURIRequired(SAMLBindingSupport.isMessageSigned(messageContext));
}
 
開發者ID:yaochi,項目名稱:pac4j-plus,代碼行數:12,代碼來源:Pac4jHTTPPostDecoder.java

示例3: getSAMLBindingContext

import org.opensaml.saml.common.messaging.context.SAMLBindingContext; //導入依賴的package包/類
public final SAMLBindingContext getSAMLBindingContext() {
    return this.getSubcontext(SAMLBindingContext.class, true);
}
 
開發者ID:yaochi,項目名稱:pac4j-plus,代碼行數:4,代碼來源:SAML2MessageContext.java

示例4: receiveMessage

import org.opensaml.saml.common.messaging.context.SAMLBindingContext; //導入依賴的package包/類
@Override
public Credentials receiveMessage(final SAML2MessageContext context) {
    final SAMLPeerEntityContext peerContext = context.getSAMLPeerEntityContext();

    peerContext.setRole(IDPSSODescriptor.DEFAULT_ELEMENT_NAME);
    context.getSAMLSelfProtocolContext().setProtocol(SAMLConstants.SAML20P_NS);
    final Pac4jHTTPPostDecoder decoder = new Pac4jHTTPPostDecoder(context.getWebContext());
    try {
        decoder.setParserPool(Configuration.getParserPool());
        decoder.initialize();
        decoder.decode();

    } catch (final Exception e) {
        throw new SAMLException("Error decoding saml message", e);
    }

    final SAML2MessageContext decodedCtx = new SAML2MessageContext(decoder.getMessageContext());
    decodedCtx.setMessage(decoder.getMessageContext().getMessage());
    decodedCtx.setSAMLMessageStorage(context.getSAMLMessageStorage());

    final SAMLBindingContext bindingContext = decodedCtx.getParent()
            .getSubcontext(SAMLBindingContext.class);

    decodedCtx.getSAMLBindingContext().setBindingDescriptor(bindingContext.getBindingDescriptor());
    decodedCtx.getSAMLBindingContext().setBindingUri(bindingContext.getBindingUri());
    decodedCtx.getSAMLBindingContext().setHasBindingSignature(bindingContext.hasBindingSignature());
    decodedCtx.getSAMLBindingContext().setIntendedDestinationEndpointURIRequired(bindingContext.isIntendedDestinationEndpointURIRequired());
    decodedCtx.getSAMLBindingContext().setRelayState(bindingContext.getRelayState());

    final AssertionConsumerService acsService = context.getSPAssertionConsumerService();
    decodedCtx.getSAMLEndpointContext().setEndpoint(acsService);

    final EntityDescriptor metadata = context.getSAMLPeerMetadataContext().getEntityDescriptor();
    if (metadata == null) {
        throw new SAMLException("IDP Metadata cannot be null");
    }

    decodedCtx.getSAMLPeerEntityContext().setEntityId(metadata.getEntityID());

    decodedCtx.getSAMLSelfEntityContext().setEntityId(context.getSAMLSelfEntityContext().getEntityId());
    decodedCtx.getSAMLSelfEndpointContext().setEndpoint(context.getSAMLSelfEndpointContext().getEndpoint());
    decodedCtx.getSAMLSelfEntityContext().setRole(context.getSAMLSelfEntityContext().getRole());

    decodedCtx.getProfileRequestContext().setProfileId(SAML2_WEBSSO_PROFILE_URI);

    decodedCtx.getSAMLSelfMetadataContext().setRoleDescriptor(context.getSPSSODescriptor());

    return this.validator.validate(decodedCtx);
}
 
開發者ID:yaochi,項目名稱:pac4j-plus,代碼行數:50,代碼來源:SAML2WebSSOMessageReceiver.java


注:本文中的org.opensaml.saml.common.messaging.context.SAMLBindingContext類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。