@Override protected Event doExecute( final @Nonnull RequestContext springRequestContext, final @Nonnull ProfileRequestContext profileRequestContext) { final RelyingPartyContext rpCtx = profileRequestContext.getSubcontext(RelyingPartyContext.class, false); if (rpCtx == null) { throw new IllegalStateException("RelyingPartyContext not found"); } final SAMLMetadataContext mdCtx = new SAMLMetadataContext(); final Service service = getCASService(profileRequestContext); final EntityDescriptor entity = service.getEntityDescriptor() != null ? service.getEntityDescriptor() : new ServiceEntityDescriptor(service); mdCtx.setEntityDescriptor(entity); rpCtx.setRelyingPartyIdContextTree(mdCtx); return null; } }
@Nonnull @Override protected Event doExecute(@Nonnull final RequestContext springRequestContext, @Nonnull final ProfileRequestContext profileRequestContext) { final RelyingPartyContext rpCtx = profileRequestContext.getSubcontext(RelyingPartyContext.class, false); if (rpCtx == null) { throw new OIDCException("Relying party context not found in the profile request"); } if (rpCtx.getRelyingPartyId() == null) { throw new OIDCException("Relying party id is blank"); } final SAMLMetadataContext mdCtx = new SAMLMetadataContext(); log.debug("Created client entity descriptor for {}", rpCtx.getRelyingPartyId()); final EntityDescriptor clientEntityDescriptor = new ClientEntityDescriptor(rpCtx.getRelyingPartyId()); mdCtx.setEntityDescriptor(clientEntityDescriptor); rpCtx.setRelyingPartyIdContextTree(mdCtx); return Events.Success.event(this); } }
metadataCtx.setEntityDescriptor((EntityDescriptor) roleMetadata.getParent()); metadataCtx.setRoleDescriptor(roleMetadata);
metadataContext.setEntityDescriptor(entityDescriptor); metadataContext.setRoleDescriptor(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()); } }
final SAMLMetadataContext outboundMetadataCtx = peerContext.getSubcontext(SAMLMetadataContext.class, true); outboundMetadataCtx.setEntityDescriptor(inboundMetadataCtx.getEntityDescriptor()); outboundMetadataCtx.setRoleDescriptor(inboundMetadataCtx.getRoleDescriptor());
metadataCtx.setEntityDescriptor((EntityDescriptor) roleMetadata.getParent()); metadataCtx.setRoleDescriptor(roleMetadata);
protected final void addContext(final SAML2MetadataResolver entityId, final BaseContext parentContext, final QName elementName) { final EntityDescriptor entityDescriptor; final RoleDescriptor roleDescriptor; try { final CriteriaSet set = new CriteriaSet(); set.add(new EntityIdCriterion(entityId.getEntityId())); entityDescriptor = this.metadata.resolveSingle(set); if (entityDescriptor == null) { throw new SAMLException("Cannot find entity " + entityId.getEntityId() + " in metadata provider"); } final List<RoleDescriptor> list = entityDescriptor.getRoleDescriptors(elementName, SAMLConstants.SAML20P_NS); roleDescriptor = CommonHelper.isNotEmpty(list) ? list.get(0) : null; if (roleDescriptor == null) { throw new SAMLException("Cannot find entity " + entityId + " or role " + elementName + " in metadata provider"); } } catch (final ResolverException e) { throw new SAMLException("An error occured while getting IDP descriptors", e); } final SAMLMetadataContext mdCtx = parentContext.getSubcontext(SAMLMetadataContext.class, true); mdCtx.setEntityDescriptor(entityDescriptor); mdCtx.setRoleDescriptor(roleDescriptor); } }