本文整理匯總了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;
}
示例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));
}
示例3: getSAMLBindingContext
import org.opensaml.saml.common.messaging.context.SAMLBindingContext; //導入依賴的package包/類
public final SAMLBindingContext getSAMLBindingContext() {
return this.getSubcontext(SAMLBindingContext.class, true);
}
示例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);
}