/** {@inheritDoc} */ @Override @Nullable @NotEmpty public String getEntityId() { if (super.getEntityId() == null) { setEntityId(resolveEntityId()); } return super.getEntityId(); }
/** {@inheritDoc} */ @Override protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) { final MessageContext msgCtx = new MessageContext(); profileRequestContext.setInboundMessageContext(msgCtx); final SAMLPeerEntityContext peerContext = msgCtx.getSubcontext(SAMLPeerEntityContext.class, true); peerContext.setEntityId(saml2Session.getId()); log.debug("{} Initialized inbound message context for logout of {}", getLogPrefix(), saml2Session.getId()); }
protected final void addIDPContext(final SAML2MessageContext context) { final SAMLPeerEntityContext peerContext = context.getSAMLPeerEntityContext(); peerContext.setEntityId(this.idpEntityId.getEntityId()); peerContext.setRole(IDPSSODescriptor.DEFAULT_ELEMENT_NAME); addContext(this.idpEntityId, peerContext, IDPSSODescriptor.DEFAULT_ELEMENT_NAME); }
messageContext.getSubcontext(SAMLPeerEntityContext.class, true).setEntityId(entry.getRelyingPartyId()); } catch (final IOException e) { log.error("{} Error resolving first artifact in request: {}", getLogPrefix(), artifact, e);
val handler = new SAML2HTTPRedirectDeflateSignatureSecurityHandler(); val peer = context.getSubcontext(SAMLPeerEntityContext.class, true); peer.setEntityId(SamlIdPUtils.getIssuerFromSamlObject(profileRequest));
rpc.setRelyingPartyIdContextTree(peerContext); peerContext.setEntityId(entityID);
log.debug("{} Authentication via request simple signature succeeded for derived issuer {}", getLogPrefix(), derivedEntityID); peerContext.setEntityId(derivedEntityID); peerContext.setAuthenticated(true);
peerContext.setEntityId(peerEntityCtx.getEntityId());
/** {@inheritDoc} */ @Override protected void doDecode() throws MessageDecodingException { final IdPInitiatedSSORequest ssoRequest = buildIdPInitiatedSSORequest(); final MessageContext<IdPInitiatedSSORequest> messageContext = new MessageContext<>(); messageContext.setMessage(ssoRequest); messageContext.getSubcontext(SAMLPeerEntityContext.class, true).setEntityId(ssoRequest.getEntityId()); final SAMLMessageInfoContext msgInfoContext = messageContext.getSubcontext(SAMLMessageInfoContext.class, true); msgInfoContext.setMessageIssueInstant(new DateTime(ssoRequest.getTime(), ISOChronology.getInstanceUTC())); msgInfoContext.setMessageId(getMessageID()); populateBindingContext(messageContext); setMessageContext(messageContext); }
/** {@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()); } }
/** * 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); }
/** {@inheritDoc} */ @Override protected void doDecode() throws MessageDecodingException { final HttpServletRequest request = getHttpServletRequest(); if (request == null) { throw new MessageDecodingException("Unable to locate HttpServletRequest"); } final ResolverTestRequest message = new ResolverTestRequest(getPrincipal(request), getRequesterId(request), getIndex(request), getProtocol(request)); final MessageContext<ResolverTestRequest> messageContext = new MessageContext<>(); messageContext.setMessage(message); setMessageContext(messageContext); final SAMLPeerEntityContext peerCtx = new SAMLPeerEntityContext(); peerCtx.setRole(SPSSODescriptor.DEFAULT_ELEMENT_NAME); peerCtx.setEntityId(message.getRequesterId()); messageContext.addSubcontext(peerCtx, true); if (message.getProtocol() != null) { messageContext.getSubcontext(SAMLProtocolContext.class, true).setProtocol(message.getProtocol()); } }
/** {@inheritDoc} */ @Override protected void doDecode() throws MessageDecodingException { final HttpServletRequest request = getHttpServletRequest(); if (request == null) { throw new MessageDecodingException("Unable to locate HttpServletRequest"); } final MetadataQueryRequest message = new MetadataQueryRequest(); message.setEntityID(getEntityID(request)); message.setProtocol(getProtocol(request)); final MessageContext<MetadataQueryRequest> messageContext = new MessageContext<>(); messageContext.setMessage(message); setMessageContext(messageContext); final SAMLPeerEntityContext peerCtx = new SAMLPeerEntityContext(); peerCtx.setRole(SPSSODescriptor.DEFAULT_ELEMENT_NAME); peerCtx.setEntityId(message.getEntityID()); messageContext.addSubcontext(peerCtx, true); if (message.getProtocol() != null) { messageContext.getSubcontext(SAMLProtocolContext.class, true).setProtocol(message.getProtocol()); } }
outboundContext.getSAMLPeerEntityContext().setEntityId(context.getSAMLPeerEntityContext().getEntityId()); outboundContext.getSAMLProtocolContext().setProtocol(context.getSAMLProtocolContext().getProtocol()); outboundContext.getSecurityParametersContext()
decodedCtx.getSAMLPeerEntityContext().setEntityId(metadata.getEntityID());