supportedOutboundBindings = bindings;
}
+ /** {@inheritDoc} */
+ public RelyingPartyConfiguration getRelyingPartyConfiguration(String relyingPartyId) {
+ try {
+ if (getMetadataProvider().getEntityDescriptor(relyingPartyId) == null) {
+ log.warn("No metadata for relying party {}, treating party as anonymous", relyingPartyId);
+ return getRelyingPartyConfigurationManager().getAnonymousRelyingConfiguration();
+ }
+ } catch (MetadataProviderException e) {
+ log.error("Unable to look up relying party metadata", e);
+ return null;
+ }
+
+ return super.getRelyingPartyConfiguration(relyingPartyId);
+ }
+
/**
* Populates the request context with information.
*
protected void populateRelyingPartyInformation(BaseSAMLProfileRequestContext requestContext)
throws ProfileException {
MetadataProvider metadataProvider = requestContext.getMetadataProvider();
- String relyingPartyId = requestContext.getPeerEntityId();
+ String relyingPartyId = requestContext.getInboundMessageIssuer();
EntityDescriptor relyingPartyMetadata;
try {
relyingPartyMetadata = metadataProvider.getEntityDescriptor(relyingPartyId);
+ requestContext.setPeerEntityMetadata(relyingPartyMetadata);
} catch (MetadataProviderException e) {
log.error("Error looking up metadata for relying party " + relyingPartyId, e);
throw new ProfileException("Error looking up metadata for relying party " + relyingPartyId);
}
- RelyingPartyConfiguration rpConfig = null;
- if (relyingPartyMetadata != null) {
- requestContext.setPeerEntityMetadata(relyingPartyMetadata);
- rpConfig = getRelyingPartyConfiguration(relyingPartyId);
- } else {
- log.warn("No metadata for relying party {}, treating party as anonymous", relyingPartyId);
- rpConfig = getRelyingPartyConfigurationManager().getAnonymousRelyingConfiguration();
- }
-
+ RelyingPartyConfiguration rpConfig = getRelyingPartyConfiguration(relyingPartyId);
if (rpConfig == null) {
log.error("Unable to retrieve relying party configuration data for entity with ID {}", relyingPartyId);
throw new ProfileException("Unable to retrieve relying party configuration data for entity with ID "
* @throws ProfileException thrown if there is a problem populating the profile information
*/
protected void populateProfileInformation(BaseSAMLProfileRequestContext requestContext) throws ProfileException {
- requestContext.setCommunicationProfileId(getProfileId());
AbstractSAMLProfileConfiguration profileConfig = (AbstractSAMLProfileConfiguration) requestContext
.getRelyingPartyConfiguration().getProfileConfiguration(getProfileId());
if (profileConfig != null) {
requestContext.setOutboundMessageArtifactType(profileConfig.getOutboundArtifactType());
}
- requestContext.setPeerEntityEndpoint(selectEndpoint(requestContext));
+ Endpoint endpoint = selectEndpoint(requestContext);
+ if (endpoint == null) {
+ log.error("No return endpoint available for relying party {}", requestContext.getInboundMessageIssuer());
+ throw new ProfileException("No peer endpoint available to which to send SAML response");
+ }
+ requestContext.setPeerEntityEndpoint(endpoint);
}
/**
*/
protected void encodeResponse(BaseSAMLProfileRequestContext requestContext) throws ProfileException {
try {
-
- Endpoint peerEndpoint = requestContext.getPeerEntityEndpoint();
- if (peerEndpoint == null) {
- log
- .error("No return endpoint available for relying party {}", requestContext
- .getInboundMessageIssuer());
- throw new ProfileException("No peer endpoint available to which to send SAML response");
- }
-
SAMLMessageEncoder encoder = getMessageEncoders().get(requestContext.getPeerEntityEndpoint().getBinding());
if (encoder == null) {
log.error("No outbound message encoder configured for binding {}", requestContext