throws ProfileException {
ArrayList<String> nameFormats = new ArrayList<String>();
- RoleDescriptor assertingPartyRole = requestContext.getAssertingPartyRoleMetadata();
+ RoleDescriptor assertingPartyRole = requestContext.getLocalEntityRoleMetadata();
List<String> assertingPartySupportedFormats = getEntitySupportedFormats(assertingPartyRole);
if (nameFormats.isEmpty()) {
- RoleDescriptor relyingPartyRole = requestContext.getRelyingPartyRoleMetadata();
+ RoleDescriptor relyingPartyRole = requestContext.getPeerEntityRoleMetadata();
List<String> relyingPartySupportedFormats = getEntitySupportedFormats(relyingPartyRole);
assertingPartySupportedFormats.retainAll(relyingPartySupportedFormats);
}
Map<String, BaseAttribute> principalAttributes = attributeAuthority.getAttributes(requestContext);
- requestContext.setPrincipalAttributes(principalAttributes);
+ requestContext.setAttributes(principalAttributes);
} catch (AttributeRequestException e) {
log.error("Error resolving attributes for SAML request from relying party "
+ requestContext.getRelyingPartyEntityId(), e);
boolean signAssertion = false;
- RoleDescriptor relyingPartyRole = requestContext.getRelyingPartyRoleMetadata();
+ RoleDescriptor relyingPartyRole = requestContext.getPeerEntityRoleMetadata();
AbstractSAML1ProfileConfiguration profileConfig = requestContext.getProfileConfiguration();
if (relyingPartyRole instanceof SPSSODescriptor) {
auditLogEntry.setRequestId(null);
auditLogEntry.setResponseBinding(getMessageEncoder().getBindingURI());
auditLogEntry.setResponseId(context.getOutboundSAMLMessageId());
- if (context.getReleasedPrincipalAttributeIds() != null) {
- auditLogEntry.getReleasedAttributes().addAll(context.getReleasedPrincipalAttributeIds());
+ if (context.getReleasedAttributes() != null) {
+ auditLogEntry.getReleasedAttributes().addAll(context.getReleasedAttributes());
}
getAduitLog().log(Level.CRITICAL, auditLogEntry);
}
requestContext.setInboundSAMLMessageIssueInstant(attributeRequest.getIssueInstant());
String relyingPartyId = requestContext.getRelyingPartyEntityId();
- requestContext.setRelyingPartyMetadata(metadataProvider.getEntityDescriptor(relyingPartyId));
- requestContext.setRelyingPartyRole(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
- requestContext.setRelyingPartyRoleMetadata(requestContext.getRelyingPartyMetadata().getSPSSODescriptor(
+ requestContext.setPeerEntityMetadata(metadataProvider.getEntityDescriptor(relyingPartyId));
+ requestContext.setPeerEntityRole(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
+ requestContext.setPeerEntityRoleMetadata(requestContext.getPeerEntityMetadata().getSPSSODescriptor(
SAMLConstants.SAML10P_NS));
RelyingPartyConfiguration rpConfig = getRelyingPartyConfiguration(relyingPartyId);
requestContext.setRelyingPartyConfiguration(rpConfig);
String assertingPartyId = requestContext.getRelyingPartyConfiguration().getProviderId();
requestContext.setAssertingPartyEntityId(assertingPartyId);
- requestContext.setAssertingPartyMetadata(metadataProvider.getEntityDescriptor(assertingPartyId));
- requestContext.setAssertingPartyRole(AttributeAuthorityDescriptor.DEFAULT_ELEMENT_NAME);
- requestContext.setAssertingPartyRoleMetadata(requestContext.getAssertingPartyMetadata()
+ requestContext.setLocalEntityMetadata(metadataProvider.getEntityDescriptor(assertingPartyId));
+ requestContext.setLocalEntityRole(AttributeAuthorityDescriptor.DEFAULT_ELEMENT_NAME);
+ requestContext.setLocalEntityRoleMetadata(requestContext.getLocalEntityMetadata()
.getAttributeAuthorityDescriptor(SAMLConstants.SAML10P_NS));
AttributeQueryConfiguration profileConfig = (AttributeQueryConfiguration) rpConfig
String relyingPartyId = loginContext.getRelyingPartyId();
requestContext.setRelyingPartyEntityId(relyingPartyId);
EntityDescriptor relyingPartyMetadata = metadataProvider.getEntityDescriptor(relyingPartyId);
- requestContext.setRelyingPartyMetadata(relyingPartyMetadata);
- requestContext.setRelyingPartyRole(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
- requestContext.setRelyingPartyRoleMetadata(relyingPartyMetadata
+ requestContext.setPeerEntityMetadata(relyingPartyMetadata);
+ requestContext.setPeerEntityRole(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
+ requestContext.setPeerEntityRoleMetadata(relyingPartyMetadata
.getSPSSODescriptor(SAMLConstants.SAML11P_NS));
RelyingPartyConfiguration rpConfig = getRelyingPartyConfiguration(relyingPartyId);
requestContext.setRelyingPartyConfiguration(rpConfig);
- requestContext.setRelyingPartyEndpoint(selectEndpoint(requestContext));
+ requestContext.setPeerEntityEndpoint(selectEndpoint(requestContext));
String assertingPartyId = rpConfig.getProviderId();
requestContext.setAssertingPartyEntityId(assertingPartyId);
EntityDescriptor assertingPartyMetadata = metadataProvider.getEntityDescriptor(assertingPartyId);
- requestContext.setAssertingPartyMetadata(assertingPartyMetadata);
- requestContext.setAssertingPartyRole(IDPSSODescriptor.DEFAULT_ELEMENT_NAME);
- requestContext.setAssertingPartyRoleMetadata(assertingPartyMetadata
+ requestContext.setLocalEntityMetadata(assertingPartyMetadata);
+ requestContext.setLocalEntityRole(IDPSSODescriptor.DEFAULT_ELEMENT_NAME);
+ requestContext.setLocalEntityRoleMetadata(assertingPartyMetadata
.getIDPSSODescriptor(SAMLConstants.SAML20P_NS));
requestContext.setMessageOutTransport(out);
BasicEndpointSelector endpointSelector = new BasicEndpointSelector();
endpointSelector.setEndpointType(AssertionConsumerService.DEFAULT_ELEMENT_NAME);
endpointSelector.setMetadataProvider(getMetadataProvider());
- endpointSelector.setRelyingParty(requestContext.getRelyingPartyMetadata());
- endpointSelector.setRelyingPartyRole(requestContext.getRelyingPartyRoleMetadata());
+ endpointSelector.setRelyingParty(requestContext.getPeerEntityMetadata());
+ endpointSelector.setRelyingPartyRole(requestContext.getPeerEntityRoleMetadata());
endpointSelector.setSamlRequest(requestContext.getInboundSAMLMessage());
endpointSelector.getSupportedIssuerBindings().addAll(supportedOutgoingBindings);
return endpointSelector.selectEndpoint();
}
Map<String, BaseAttribute> principalAttributes = attributeAuthority.getAttributes(requestContext);
- requestContext.setPrincipalAttributes(principalAttributes);
+ requestContext.setAttributes(principalAttributes);
} catch (AttributeRequestException e) {
log.error("Error resolving attributes for SAML request " + requestContext.getInboundSAMLMessageId()
+ " from relying party " + requestContext.getRelyingPartyEntityId(), e);
AbstractSAML2ProfileConfiguration profileConfig = requestContext.getProfileConfiguration();
- if (requestContext.getRelyingPartyRoleMetadata() instanceof SPSSODescriptor) {
- SPSSODescriptor ssoDescriptor = (SPSSODescriptor) requestContext.getRelyingPartyRoleMetadata();
+ if (requestContext.getPeerEntityRoleMetadata() instanceof SPSSODescriptor) {
+ SPSSODescriptor ssoDescriptor = (SPSSODescriptor) requestContext.getPeerEntityRoleMetadata();
if (ssoDescriptor.getWantAssertionsSigned() != null) {
signAssertion = ssoDescriptor.getWantAssertionsSigned().booleanValue();
if (log.isDebugEnabled()) {
confirmationData.setNotOnOrAfter(issueInstant.plus(requestContext.getProfileConfiguration()
.getAssertionLifetime()));
- Endpoint relyingPartyEndpoint = requestContext.getRelyingPartyEndpoint();
+ Endpoint relyingPartyEndpoint = requestContext.getPeerEntityEndpoint();
if (relyingPartyEndpoint != null) {
if (relyingPartyEndpoint.getResponseLocation() != null) {
confirmationData.setRecipient(relyingPartyEndpoint.getResponseLocation());
ArrayList<String> nameFormats = new ArrayList<String>();
List<String> assertingPartySupportedFormats = getEntitySupportedFormats(requestContext
- .getAssertingPartyRoleMetadata());
+ .getLocalEntityRoleMetadata());
String nameFormat = null;
if (requestContext.getInboundSAMLMessage() instanceof AuthnRequest) {
if (nameFormats.isEmpty()) {
List<String> relyingPartySupportedFormats = getEntitySupportedFormats(requestContext
- .getRelyingPartyRoleMetadata());
+ .getPeerEntityRoleMetadata());
assertingPartySupportedFormats.retainAll(relyingPartySupportedFormats);
nameFormats.addAll(assertingPartySupportedFormats);
auditLogEntry.setRequestId(context.getInboundSAMLMessageId());
auditLogEntry.setResponseBinding(getMessageEncoder().getBindingURI());
auditLogEntry.setResponseId(context.getOutboundSAMLMessageId());
- if (context.getReleasedPrincipalAttributeIds() != null) {
- auditLogEntry.getReleasedAttributes().addAll(context.getReleasedPrincipalAttributeIds());
+ if (context.getReleasedAttributes() != null) {
+ auditLogEntry.getReleasedAttributes().addAll(context.getReleasedAttributes());
}
getAduitLog().log(Level.CRITICAL, auditLogEntry);
}
requestContext.setInboundSAMLMessageIssueInstant(attributeQuery.getIssueInstant());
String relyingPartyId = requestContext.getRelyingPartyEntityId();
- requestContext.setRelyingPartyMetadata(metadataProvider.getEntityDescriptor(relyingPartyId));
- requestContext.setRelyingPartyRole(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
- requestContext.setRelyingPartyRoleMetadata(requestContext.getRelyingPartyMetadata().getSPSSODescriptor(
+ requestContext.setPeerEntityMetadata(metadataProvider.getEntityDescriptor(relyingPartyId));
+ requestContext.setPeerEntityRole(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
+ requestContext.setPeerEntityRoleMetadata(requestContext.getPeerEntityMetadata().getSPSSODescriptor(
SAMLConstants.SAML20P_NS));
RelyingPartyConfiguration rpConfig = getRelyingPartyConfiguration(relyingPartyId);
requestContext.setRelyingPartyConfiguration(rpConfig);
String assertingPartyId = requestContext.getRelyingPartyConfiguration().getProviderId();
requestContext.setAssertingPartyEntityId(assertingPartyId);
- requestContext.setAssertingPartyMetadata(metadataProvider.getEntityDescriptor(assertingPartyId));
- requestContext.setAssertingPartyRole(AttributeAuthorityDescriptor.DEFAULT_ELEMENT_NAME);
- requestContext.setAssertingPartyRoleMetadata(requestContext.getAssertingPartyMetadata()
+ requestContext.setLocalEntityMetadata(metadataProvider.getEntityDescriptor(assertingPartyId));
+ requestContext.setLocalEntityRole(AttributeAuthorityDescriptor.DEFAULT_ELEMENT_NAME);
+ requestContext.setLocalEntityRoleMetadata(requestContext.getLocalEntityMetadata()
.getAttributeAuthorityDescriptor(SAMLConstants.SAML20P_NS));
AttributeQueryConfiguration profileConfig = (AttributeQueryConfiguration) rpConfig
String relyingPartyId = loginContext.getRelyingPartyId();
requestContext.setRelyingPartyEntityId(relyingPartyId);
EntityDescriptor relyingPartyMetadata = metadataProvider.getEntityDescriptor(relyingPartyId);
- requestContext.setRelyingPartyMetadata(relyingPartyMetadata);
- requestContext.setRelyingPartyRole(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
- requestContext.setRelyingPartyRoleMetadata(relyingPartyMetadata
+ requestContext.setPeerEntityMetadata(relyingPartyMetadata);
+ requestContext.setPeerEntityRole(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
+ requestContext.setPeerEntityRoleMetadata(relyingPartyMetadata
.getSPSSODescriptor(SAMLConstants.SAML20P_NS));
RelyingPartyConfiguration rpConfig = getRelyingPartyConfiguration(relyingPartyId);
requestContext.setRelyingPartyConfiguration(rpConfig);
- requestContext.setRelyingPartyEndpoint(selectEndpoint(requestContext));
+ requestContext.setPeerEntityEndpoint(selectEndpoint(requestContext));
String assertingPartyId = rpConfig.getProviderId();
requestContext.setAssertingPartyEntityId(assertingPartyId);
EntityDescriptor assertingPartyMetadata = metadataProvider.getEntityDescriptor(assertingPartyId);
- requestContext.setAssertingPartyMetadata(assertingPartyMetadata);
- requestContext.setAssertingPartyRole(IDPSSODescriptor.DEFAULT_ELEMENT_NAME);
- requestContext.setAssertingPartyRoleMetadata(assertingPartyMetadata
+ requestContext.setLocalEntityMetadata(assertingPartyMetadata);
+ requestContext.setLocalEntityRole(IDPSSODescriptor.DEFAULT_ELEMENT_NAME);
+ requestContext.setLocalEntityRoleMetadata(assertingPartyMetadata
.getIDPSSODescriptor(SAMLConstants.SAML20P_NS));
requestContext.setMessageOutTransport(out);
AuthnResponseEndpointSelector endpointSelector = new AuthnResponseEndpointSelector();
endpointSelector.setEndpointType(AssertionConsumerService.DEFAULT_ELEMENT_NAME);
endpointSelector.setMetadataProvider(getMetadataProvider());
- endpointSelector.setRelyingParty(requestContext.getRelyingPartyMetadata());
- endpointSelector.setRelyingPartyRole(requestContext.getRelyingPartyRoleMetadata());
+ endpointSelector.setRelyingParty(requestContext.getPeerEntityMetadata());
+ endpointSelector.setRelyingPartyRole(requestContext.getPeerEntityRoleMetadata());
endpointSelector.setSamlRequest(requestContext.getInboundSAMLMessage());
endpointSelector.getSupportedIssuerBindings().addAll(supportedOutgoingBindings);
return endpointSelector.selectEndpoint();
import org.opensaml.ws.soap.common.SOAPObjectBuilder;
import org.opensaml.ws.soap.soap11.Body;
import org.opensaml.ws.soap.soap11.Envelope;
+import org.opensaml.ws.transport.http.HTTPInTransport;
+import org.opensaml.ws.transport.http.HTTPOutTransport;
+import org.opensaml.ws.transport.http.HttpServletRequestAdapter;
+import org.opensaml.ws.transport.http.HttpServletResponseAdapter;
import org.opensaml.xml.io.Marshaller;
import org.opensaml.xml.io.MarshallingException;
import org.opensaml.xml.util.XMLHelper;
import edu.internet2.middleware.shibboleth.common.profile.ProfileHandler;
import edu.internet2.middleware.shibboleth.common.profile.ProfileHandlerManager;
-import edu.internet2.middleware.shibboleth.common.profile.ProfileRequest;
-import edu.internet2.middleware.shibboleth.common.profile.ProfileResponse;
-import edu.internet2.middleware.shibboleth.idp.profile.ShibbolethProfileRequest;
-import edu.internet2.middleware.shibboleth.idp.profile.ShibbolethProfileResponse;
/**
* A system test that meant to simulate various types of SAML 2 attribute queries.
assertNotNull(handler);
// Process request
- ProfileRequest profileRequest = new ShibbolethProfileRequest(servletRequest);
- ProfileResponse profileResponse = new ShibbolethProfileResponse(servletResponse);
+ HTTPInTransport profileRequest = new HttpServletRequestAdapter(servletRequest);
+ HTTPOutTransport profileResponse = new HttpServletResponseAdapter(servletResponse);
handler.processRequest(profileRequest, profileResponse);
String response = servletResponse.getContentAsString();
assertNotNull(handler);
// Process request
- ProfileRequest profileRequest = new ShibbolethProfileRequest(servletRequest);
- ProfileResponse profileResponse = new ShibbolethProfileResponse(servletResponse);
+ HTTPInTransport profileRequest = new HttpServletRequestAdapter(servletRequest);
+ HTTPOutTransport profileResponse = new HttpServletResponseAdapter(servletResponse);
handler.processRequest(profileRequest, profileResponse);
String response = servletResponse.getContentAsString();
assertNotNull(handler);
// Process request
- ProfileRequest profileRequest = new ShibbolethProfileRequest(servletRequest);
- ProfileResponse profileResponse = new ShibbolethProfileResponse(servletResponse);
+ HTTPInTransport profileRequest = new HttpServletRequestAdapter(servletRequest);
+ HTTPOutTransport profileResponse = new HttpServletResponseAdapter(servletResponse);
handler.processRequest(profileRequest, profileResponse);
String response = servletResponse.getContentAsString();
import org.joda.time.DateTime;
import org.opensaml.common.SAMLObjectBuilder;
-import org.opensaml.saml2.binding.decoding.HTTPPostDecoder;
import org.opensaml.saml2.core.AuthnRequest;
import org.opensaml.saml2.core.Issuer;
+import org.opensaml.ws.transport.http.HTTPInTransport;
+import org.opensaml.ws.transport.http.HTTPOutTransport;
+import org.opensaml.ws.transport.http.HttpServletRequestAdapter;
+import org.opensaml.ws.transport.http.HttpServletResponseAdapter;
import org.opensaml.xml.io.Marshaller;
import org.opensaml.xml.io.MarshallingException;
import org.opensaml.xml.util.Base64;
import edu.internet2.middleware.shibboleth.common.profile.ProfileException;
import edu.internet2.middleware.shibboleth.common.profile.ProfileHandler;
import edu.internet2.middleware.shibboleth.common.profile.ProfileHandlerManager;
-import edu.internet2.middleware.shibboleth.common.profile.ProfileRequest;
-import edu.internet2.middleware.shibboleth.common.profile.ProfileResponse;
import edu.internet2.middleware.shibboleth.idp.authn.Saml2LoginContext;
-import edu.internet2.middleware.shibboleth.idp.profile.IdPProfileHandlerManager;
-import edu.internet2.middleware.shibboleth.idp.profile.ShibbolethProfileRequest;
-import edu.internet2.middleware.shibboleth.idp.profile.ShibbolethProfileResponse;
/**
*
MockHttpServletRequest servletRequest = new MockHttpServletRequest();
servletRequest.setPathInfo("/IdP/saml2/SSONoAuth");
- servletRequest.setParameter(HTTPPostDecoder.REQUEST_PARAM, Base64.encodeBytes(authnRequestString.getBytes()));
+ servletRequest.setParameter("SAMLRequest", Base64.encodeBytes(authnRequestString.getBytes()));
MockHttpServletResponse servletResponse = new MockHttpServletResponse();
assertNotNull(handler);
// Process request
- ProfileRequest profileRequest = new ShibbolethProfileRequest(servletRequest);
- ProfileResponse profileResponse = new ShibbolethProfileResponse(servletResponse);
+ HTTPInTransport profileRequest = new HttpServletRequestAdapter(servletRequest);
+ HTTPOutTransport profileResponse = new HttpServletResponseAdapter(servletResponse);
try {
handler.processRequest(profileRequest, profileResponse);
MockHttpServletRequest servletRequest = new MockHttpServletRequest();
servletRequest.setPathInfo("/IdP/saml2/SSONoAuth");
- servletRequest.setParameter(HTTPPostDecoder.REQUEST_PARAM, Base64.encodeBytes(authnRequestString.getBytes()));
+ servletRequest.setParameter("SAMLRequest", Base64.encodeBytes(authnRequestString.getBytes()));
MockHttpServletResponse servletResponse = new MockHttpServletResponse();
assertNotNull(handler);
// Process request
- ProfileRequest profileRequest = new ShibbolethProfileRequest(servletRequest);
- ProfileResponse profileResponse = new ShibbolethProfileResponse(servletResponse);
+ HTTPInTransport profileRequest = new HttpServletRequestAdapter(servletRequest);
+ HTTPOutTransport profileResponse = new HttpServletResponseAdapter(servletResponse);
handler.processRequest(profileRequest, profileResponse);
HttpSession session = servletRequest.getSession();
public void testSecondLeg() throws Exception {
AuthnRequest authnRequest = buildAuthnRequest("urn:example.org:unitTestFed:sp2");
-
+
Saml2LoginContext loginContext = new Saml2LoginContext("urn:example.org:unitTestFed:sp2", null, authnRequest);
loginContext.setAuthenticationInstant(new DateTime());
loginContext.setAuthenticationMethod("urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified");
loginContext.setPrincipalAuthenticated(true);
- loginContext.setPrincipalName("testUser");
+ loginContext.setPrincipalName("testUser");
MockHttpServletRequest servletRequest = new MockHttpServletRequest();
servletRequest.setPathInfo("/IdP/saml2/SSONoAuth");
-
+
HttpSession session = servletRequest.getSession();
session.setAttribute(Saml2LoginContext.LOGIN_CONTEXT_KEY, loginContext);
assertNotNull(handler);
// Process request
- ProfileRequest profileRequest = new ShibbolethProfileRequest(servletRequest);
- ProfileResponse profileResponse = new ShibbolethProfileResponse(servletResponse);
+ HTTPInTransport profileRequest = new HttpServletRequestAdapter(servletRequest);
+ HTTPOutTransport profileResponse = new HttpServletResponseAdapter(servletResponse);
handler.processRequest(profileRequest, profileResponse);
System.out.println(servletResponse.getContentAsString());