public final SAMLMetadataContext getSAMLPeerMetadataContext() { return getSAMLPeerEntityContext().getSubcontext(SAMLMetadataContext.class, true); }
public final SAMLEndpointContext getSAMLPeerEndpointContext() { return getSAMLPeerEntityContext().getSubcontext(SAMLEndpointContext.class, true); }
/** {@inheritDoc} */ @Override @Nullable public SSODescriptor apply(@Nullable final ProfileRequestContext input) { if (input != null && input.getInboundMessageContext() != null) { final SAMLPeerEntityContext peerCtx = input.getInboundMessageContext().getSubcontext(SAMLPeerEntityContext.class); if (peerCtx != null) { SAMLMetadataContext mdCtx = peerCtx.getSubcontext(SAMLMetadataContext.class); if (mdCtx != null && mdCtx.getRoleDescriptor() != null && mdCtx.getRoleDescriptor() instanceof SSODescriptor) { return (SSODescriptor) mdCtx.getRoleDescriptor(); } else { log.debug("No SAMLMetadataContext or SSODescriptor role available"); } } else { log.debug("No SAMLPeerEntityContext available"); } } else { log.debug("No inbound message context available"); } return null; } }
SAMLMetadataContext metadataContext = peerContext.getSubcontext(SAMLMetadataContext.class, false); if (metadataContext == null || metadataContext.getRoleDescriptor() == null) { log.warn("SAMLPeerContext did not contain either a SAMLMetadataContext or a RoleDescriptor, "
/** {@inheritDoc} */ @Override protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) { final MessageContext msgCtx = new MessageContext(); profileRequestContext.setOutboundMessageContext(msgCtx); final SAMLSelfEntityContext selfContext = msgCtx.getSubcontext(SAMLSelfEntityContext.class, true); selfContext.setEntityId(selfIdentityLookupStrategy.apply(profileRequestContext)); final SAMLPeerEntityContext peerContext = msgCtx.getSubcontext(SAMLPeerEntityContext.class, true); peerContext.setEntityId(peerEntityCtx.getEntityId()); final SAMLMetadataContext inboundMetadataCtx = peerEntityCtx.getSubcontext(SAMLMetadataContext.class); if (inboundMetadataCtx != null) { final SAMLMetadataContext outboundMetadataCtx = peerContext.getSubcontext(SAMLMetadataContext.class, true); outboundMetadataCtx.setEntityDescriptor(inboundMetadataCtx.getEntityDescriptor()); outboundMetadataCtx.setRoleDescriptor(inboundMetadataCtx.getRoleDescriptor()); final AttributeConsumingServiceContext acsCtx = inboundMetadataCtx.getSubcontext(AttributeConsumingServiceContext.class); if (null != acsCtx) { outboundMetadataCtx.getSubcontext(AttributeConsumingServiceContext.class, true) .setAttributeConsumingService(acsCtx.getAttributeConsumingService()); } } log.debug("{} Initialized outbound message context", getLogPrefix()); } }
peerContext.setEntityId(peerEntityCtx.getEntityId()); final SAMLMetadataContext inboundMetadataCtx = peerEntityCtx.getSubcontext(SAMLMetadataContext.class); if (inboundMetadataCtx != null) { final SAMLMetadataContext outboundMetadataCtx = peerContext.getSubcontext(SAMLMetadataContext.class, true); outboundMetadataCtx.setEntityDescriptor(inboundMetadataCtx.getEntityDescriptor()); outboundMetadataCtx.setRoleDescriptor(inboundMetadataCtx.getRoleDescriptor());
final SAMLEndpointContext endpointContext = peerContext.getSubcontext(SAMLEndpointContext.class, false); if (endpointContext == null) { throw new BindingException("PeerEntityContext contained no SAMLEndpointContext");
final SAMLMetadataContext metadataContext = peerContext.getSubcontext(SAMLMetadataContext.class, true); metadataContext.setEntityDescriptor(entityDescriptor); metadataContext.setRoleDescriptor(roleDescriptor);
final SAMLMetadataContext metadataCtx = peerCtx.getSubcontext(SAMLMetadataContext.class); if (metadataCtx != null && metadataCtx.getRoleDescriptor() != null) { log.debug("{} Adding role metadata to resolution criteria", getLogPrefix());
/** * Prepare peer entity saml endpoint. * * @param request the authn request * @param outboundContext the outbound context * @param adaptor the adaptor * @param binding the binding * @throws SamlException the saml exception */ public static void preparePeerEntitySamlEndpointContext(final RequestAbstractType request, final MessageContext outboundContext, final SamlRegisteredServiceServiceProviderMetadataFacade adaptor, final String binding) throws SamlException { val entityId = adaptor.getEntityId(); if (!adaptor.containsAssertionConsumerServices()) { throw new SamlException("No assertion consumer service could be found for entity " + entityId); } val peerEntityContext = outboundContext.getSubcontext(SAMLPeerEntityContext.class, true); if (peerEntityContext == null) { throw new SamlException("SAMLPeerEntityContext could not be defined for entity " + entityId); } peerEntityContext.setEntityId(entityId); val endpointContext = peerEntityContext.getSubcontext(SAMLEndpointContext.class, true); if (endpointContext == null) { throw new SamlException("SAMLEndpointContext could not be defined for entity " + entityId); } val endpoint = determineEndpointForRequest(request, adaptor, binding); LOGGER.debug("Configured peer entity endpoint to be [{}] with binding [{}]", endpoint.getLocation(), endpoint.getBinding()); endpointContext.setEndpoint(endpoint); }