package edu.internet2.middleware.shibboleth.idp.profile.saml1;
import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import org.apache.log4j.Logger;
-import org.opensaml.common.SAMLObject;
import org.opensaml.common.SAMLObjectBuilder;
-import org.opensaml.common.binding.BindingException;
-import org.opensaml.common.binding.encoding.MessageEncoder;
+import org.opensaml.common.binding.decoding.SAMLMessageDecoder;
+import org.opensaml.common.xml.SAMLConstants;
+import org.opensaml.saml1.core.AttributeStatement;
import org.opensaml.saml1.core.AuthenticationStatement;
+import org.opensaml.saml1.core.Request;
import org.opensaml.saml1.core.Response;
import org.opensaml.saml1.core.Statement;
import org.opensaml.saml1.core.StatusCode;
import org.opensaml.saml1.core.Subject;
+import org.opensaml.saml1.core.SubjectLocality;
+import org.opensaml.saml2.metadata.AssertionConsumerService;
+import org.opensaml.saml2.metadata.Endpoint;
+import org.opensaml.saml2.metadata.EntityDescriptor;
import org.opensaml.saml2.metadata.IDPSSODescriptor;
import org.opensaml.saml2.metadata.SPSSODescriptor;
+import org.opensaml.ws.message.decoder.MessageDecodingException;
+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.security.SecurityException;
import org.opensaml.xml.util.DatatypeHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import edu.internet2.middleware.shibboleth.common.ShibbolethConstants;
import edu.internet2.middleware.shibboleth.common.profile.ProfileException;
-import edu.internet2.middleware.shibboleth.common.profile.ProfileRequest;
-import edu.internet2.middleware.shibboleth.common.profile.ProfileResponse;
+import edu.internet2.middleware.shibboleth.common.profile.provider.BaseSAMLProfileRequestContext;
+import edu.internet2.middleware.shibboleth.common.relyingparty.ProfileConfiguration;
import edu.internet2.middleware.shibboleth.common.relyingparty.RelyingPartyConfiguration;
import edu.internet2.middleware.shibboleth.common.relyingparty.provider.saml1.ShibbolethSSOConfiguration;
+import edu.internet2.middleware.shibboleth.common.util.HttpHelper;
import edu.internet2.middleware.shibboleth.idp.authn.LoginContext;
import edu.internet2.middleware.shibboleth.idp.authn.ShibbolethSSOLoginContext;
public class ShibbolethSSOProfileHandler extends AbstractSAML1ProfileHandler {
/** Class logger. */
- private final Logger log = Logger.getLogger(ShibbolethSSOProfileHandler.class);
+ private final Logger log = LoggerFactory.getLogger(ShibbolethSSOProfileHandler.class);
/** Builder of AuthenticationStatement objects. */
private SAMLObjectBuilder<AuthenticationStatement> authnStatementBuilder;
+ /** Builder of SubjectLocality objects. */
+ private SAMLObjectBuilder<SubjectLocality> subjectLocalityBuilder;
+
+ /** Builder of Endpoint objects. */
+ private SAMLObjectBuilder<Endpoint> endpointBuilder;
+
/** URL of the authentication manager servlet. */
private String authenticationManagerPath;
- /** Message encoder binding URI. */
- private String encodingBinding;
-
/**
* Constructor.
*
* @param authnManagerPath path to the authentication manager servlet
- * @param encoder URI of the encoding binding
*
* @throws IllegalArgumentException thrown if either the authentication manager path or encoding binding URI are
* null or empty
*/
- public ShibbolethSSOProfileHandler(String authnManagerPath, String encoder) {
- if (DatatypeHelper.isEmpty(authnManagerPath) || DatatypeHelper.isEmpty(encoder)) {
- throw new IllegalArgumentException("Authentication manager path and encoder binding URI may not be null");
+ public ShibbolethSSOProfileHandler(String authnManagerPath) {
+ if (DatatypeHelper.isEmpty(authnManagerPath)) {
+ throw new IllegalArgumentException("Authentication manager path may not be null");
}
-
authenticationManagerPath = authnManagerPath;
- encodingBinding = encoder;
authnStatementBuilder = (SAMLObjectBuilder<AuthenticationStatement>) getBuilderFactory().getBuilder(
AuthenticationStatement.DEFAULT_ELEMENT_NAME);
- }
- /**
- * Convenience method for getting the SAML 1 AuthenticationStatement builder.
- *
- * @return SAML 1 AuthenticationStatement builder
- */
- public SAMLObjectBuilder<AuthenticationStatement> getAuthenticationStatementBuilder() {
- return authnStatementBuilder;
+ subjectLocalityBuilder = (SAMLObjectBuilder<SubjectLocality>) getBuilderFactory().getBuilder(
+ SubjectLocality.DEFAULT_ELEMENT_NAME);
+
+ endpointBuilder = (SAMLObjectBuilder<Endpoint>) getBuilderFactory().getBuilder(
+ AssertionConsumerService.DEFAULT_ELEMENT_NAME);
}
/** {@inheritDoc} */
public String getProfileId() {
- return "urn:mace:shibboleth:2.0:idp:profiles:shibboleth:request:sso";
+ return ShibbolethSSOConfiguration.PROFILE_ID;
}
/** {@inheritDoc} */
- public void processRequest(ProfileRequest<ServletRequest> request, ProfileResponse<ServletResponse> response)
- throws ProfileException {
+ public void processRequest(HTTPInTransport inTransport, HTTPOutTransport outTransport) throws ProfileException {
+ log.debug("Processing incoming request");
- HttpSession httpSession = ((HttpServletRequest) request.getRawRequest()).getSession(true);
- if (httpSession.getAttribute(LoginContext.LOGIN_CONTEXT_KEY) == null) {
- performAuthentication(request, response);
+ HttpServletRequest httpRequest = ((HttpServletRequestAdapter) inTransport).getWrappedRequest();
+ LoginContext loginContext = (LoginContext) httpRequest.getAttribute(LoginContext.LOGIN_CONTEXT_KEY);
+
+ if (loginContext == null) {
+ log.debug("Incoming request does not contain a login context, processing as first leg of request");
+ performAuthentication(inTransport, outTransport);
} else {
- completeAuthenticationRequest(request, response);
+ log.debug("Incoming request contains a login context, processing as second leg of request");
+ completeAuthenticationRequest(inTransport, outTransport);
}
}
* Creates a {@link LoginContext} an sends the request off to the AuthenticationManager to begin the process of
* authenticating the user.
*
- * @param request current request
- * @param response current response
+ * @param inTransport inbound message transport
+ * @param outTransport outbound message transport
*
* @throws ProfileException thrown if there is a problem creating the login context and transferring control to the
* authentication manager
*/
- protected void performAuthentication(ProfileRequest<ServletRequest> request,
- ProfileResponse<ServletResponse> response) throws ProfileException {
+ protected void performAuthentication(HTTPInTransport inTransport, HTTPOutTransport outTransport)
+ throws ProfileException {
+
+ HttpServletRequest httpRequest = ((HttpServletRequestAdapter) inTransport).getWrappedRequest();
+ HttpServletResponse httpResponse = ((HttpServletResponseAdapter) outTransport).getWrappedResponse();
- HttpServletRequest httpRequest = (HttpServletRequest) request.getRawRequest();
- HttpServletResponse httpResponse = (HttpServletResponse) response.getRawResponse();
- HttpSession httpSession = httpRequest.getSession(true);
+ ShibbolethSSORequestContext requestContext = decodeRequest(inTransport, outTransport);
+ ShibbolethSSOLoginContext loginContext = requestContext.getLoginContext();
+
+ RelyingPartyConfiguration rpConfig = getRelyingPartyConfiguration(loginContext.getRelyingPartyId());
+ ProfileConfiguration ssoConfig = rpConfig.getProfileConfiguration(ShibbolethSSOConfiguration.PROFILE_ID);
+ if (ssoConfig == null) {
+ log.error("Shibboleth SSO profile is not configured for relying party " + loginContext.getRelyingPartyId());
+ throw new ProfileException("Shibboleth SSO profile is not configured for relying party "
+ + loginContext.getRelyingPartyId());
+ }
+ loginContext.getRequestedAuthenticationMethods().add(rpConfig.getDefaultAuthenticationMethod());
- LoginContext loginContext = buildLoginContext(httpRequest);
- httpSession.setAttribute(LoginContext.LOGIN_CONTEXT_KEY, loginContext);
+ httpRequest.setAttribute(LoginContext.LOGIN_CONTEXT_KEY, loginContext);
try {
RequestDispatcher dispatcher = httpRequest.getRequestDispatcher(authenticationManagerPath);
dispatcher.forward(httpRequest, httpResponse);
+ return;
} catch (IOException ex) {
log.error("Error forwarding Shibboleth SSO request to AuthenticationManager", ex);
throw new ProfileException("Error forwarding Shibboleth SSO request to AuthenticationManager", ex);
}
/**
+ * Decodes an incoming request and populates a created request context with the resultant information.
+ *
+ * @param inTransport inbound message transport
+ * @param outTransport outbound message transport
+ *
+ * @return the created request context
+ *
+ * @throws ProfileException throw if there is a problem decoding the request
+ */
+ protected ShibbolethSSORequestContext decodeRequest(HTTPInTransport inTransport, HTTPOutTransport outTransport)
+ throws ProfileException {
+ log.debug("Decoding message with decoder binding {}", getInboundBinding());
+
+ HttpServletRequest httpRequest = ((HttpServletRequestAdapter) inTransport).getWrappedRequest();
+
+ ShibbolethSSORequestContext requestContext = new ShibbolethSSORequestContext();
+ requestContext.setCommunicationProfileId(getProfileId());
+
+ requestContext.setMetadataProvider(getMetadataProvider());
+ requestContext.setSecurityPolicyResolver(getSecurityPolicyResolver());
+
+ requestContext.setCommunicationProfileId(ShibbolethSSOConfiguration.PROFILE_ID);
+ requestContext.setInboundMessageTransport(inTransport);
+ requestContext.setInboundSAMLProtocol(ShibbolethConstants.SHIB_SSO_PROFILE_URI);
+ requestContext.setPeerEntityRole(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
+
+ requestContext.setOutboundMessageTransport(outTransport);
+ requestContext.setOutboundSAMLProtocol(SAMLConstants.SAML11P_NS);
+
+ SAMLMessageDecoder decoder = getMessageDecoders().get(getInboundBinding());
+ requestContext.setMessageDecoder(decoder);
+ try {
+ decoder.decode(requestContext);
+ } catch (MessageDecodingException e) {
+ log.error("Error decoding Shibboleth SSO request", e);
+ throw new ProfileException("Error decoding Shibboleth SSO request", e);
+ } catch (SecurityException e) {
+ log.error("Shibboleth SSO request does not meet security requirements", e);
+ throw new ProfileException("Shibboleth SSO request does not meet security requirements", e);
+ }
+
+ ShibbolethSSOLoginContext loginContext = new ShibbolethSSOLoginContext();
+ loginContext.setRelyingParty(requestContext.getInboundMessageIssuer());
+ loginContext.setSpAssertionConsumerService(requestContext.getSpAssertionConsumerService());
+ loginContext.setSpTarget(requestContext.getRelayState());
+ loginContext.setAuthenticationEngineURL(authenticationManagerPath);
+ loginContext.setProfileHandlerURL(HttpHelper.getRequestUriWithoutContext(httpRequest));
+ requestContext.setLoginContext(loginContext);
+
+ return requestContext;
+ }
+
+ /**
* Creates a response to the Shibboleth SSO and sends the user, with response in tow, back to the relying party
* after they've been authenticated.
*
- * @param request current request
- * @param response current response
+ * @param inTransport inbound message transport
+ * @param outTransport outbound message transport
*
* @throws ProfileException thrown if the response can not be created and sent back to the relying party
*/
- protected void completeAuthenticationRequest(ProfileRequest<ServletRequest> request,
- ProfileResponse<ServletResponse> response) throws ProfileException {
- HttpSession httpSession = ((HttpServletRequest) request.getRawRequest()).getSession(true);
-
- ShibbolethSSOLoginContext loginContext = (ShibbolethSSOLoginContext) httpSession
+ protected void completeAuthenticationRequest(HTTPInTransport inTransport, HTTPOutTransport outTransport)
+ throws ProfileException {
+ HttpServletRequest httpRequest = ((HttpServletRequestAdapter) inTransport).getWrappedRequest();
+ ShibbolethSSOLoginContext loginContext = (ShibbolethSSOLoginContext) httpRequest
.getAttribute(LoginContext.LOGIN_CONTEXT_KEY);
- httpSession.removeAttribute(LoginContext.LOGIN_CONTEXT_KEY);
- ShibbolethSSORequestContext requestContext = buildRequestContext(loginContext, request, response);
+ ShibbolethSSORequestContext requestContext = buildRequestContext(loginContext, inTransport, outTransport);
Response samlResponse;
try {
- if (!loginContext.isPrincipalAuthenticated()) {
+ if (loginContext.getAuthenticationFailure() != null) {
+ log.error("User authentication failed with the following error: {}", loginContext
+ .getAuthenticationFailure().toString());
requestContext.setFailureStatus(buildStatus(StatusCode.RESPONDER, null, "User failed authentication"));
- throw new ProfileException("User failed authentication");
+ throw new ProfileException("Authentication failure", loginContext.getAuthenticationFailure());
}
+ resolveAttributes(requestContext);
+
ArrayList<Statement> statements = new ArrayList<Statement>();
statements.add(buildAuthenticationStatement(requestContext));
if (requestContext.getProfileConfiguration().includeAttributeStatement()) {
- statements
- .add(buildAttributeStatement(requestContext, "urn:oasis:names:tc:SAML:1.0:cm:sender-vouches"));
+ AttributeStatement attributeStatement = buildAttributeStatement(requestContext,
+ "urn:oasis:names:tc:SAML:1.0:cm:bearer");
+ if (attributeStatement != null) {
+ requestContext.setRequestedAttributes(requestContext.getAttributes().keySet());
+ statements.add(attributeStatement);
+ }
}
samlResponse = buildResponse(requestContext, statements);
samlResponse = buildErrorResponse(requestContext);
}
- requestContext.setSamlResponse(samlResponse);
+ requestContext.setOutboundSAMLMessage(samlResponse);
+ requestContext.setOutboundSAMLMessageId(samlResponse.getID());
+ requestContext.setOutboundSAMLMessageIssueInstant(samlResponse.getIssueInstant());
encodeResponse(requestContext);
writeAuditLogEntry(requestContext);
}
/**
- * Creates a login context from the incoming HTTP request.
- *
- * @param request current HTTP request
- *
- * @return the constructed login context
- *
- * @throws ProfileException thrown if the incomming request did not contain a providerId, shire, and target
- * parameter
- */
- protected ShibbolethSSOLoginContext buildLoginContext(HttpServletRequest request) throws ProfileException {
- ShibbolethSSOLoginContext loginContext = new ShibbolethSSOLoginContext();
-
- try {
- String providerId = DatatypeHelper.safeTrimOrNullString(request.getParameter("providerId"));
- if (providerId == null) {
- log.error("No providerId parameter in Shibboleth SSO request");
- throw new ProfileException("No providerId parameter in Shibboleth SSO request");
- }
- loginContext.setRelyingParty(URLDecoder.decode(providerId, "UTF-8"));
-
- String acs = DatatypeHelper.safeTrimOrNullString(request.getParameter("shire"));
- if (acs == null) {
- log.error("No shire parameter in Shibboleth SSO request");
- throw new ProfileException("No shire parameter in Shibboleth SSO request");
- }
- loginContext.setSpAssertionConsumerService(URLDecoder.decode(acs, "UTF-8"));
-
- String target = DatatypeHelper.safeTrimOrNullString(request.getParameter("target"));
- if (target == null) {
- log.error("No target parameter in Shibboleth SSO request");
- throw new ProfileException("No target parameter in Shibboleth SSO request");
- }
- loginContext.setSpTarget(URLDecoder.decode(target, "UTF-8"));
- } catch (UnsupportedEncodingException e) {
- // UTF-8 encoding required to be supported by all JVMs.
- }
-
- loginContext.setAuthenticationManagerURL(authenticationManagerPath);
- loginContext.setProfileHandlerURL(request.getRequestURI());
- return loginContext;
- }
-
- /**
* Creates an authentication request context from the current environmental information.
*
* @param loginContext current login context
- * @param request current request
- * @param response current response
+ * @param in inbound transport
+ * @param out outbount transport
*
* @return created authentication request context
+ *
+ * @throws ProfileException thrown if there is a problem creating the context
*/
protected ShibbolethSSORequestContext buildRequestContext(ShibbolethSSOLoginContext loginContext,
- ProfileRequest<ServletRequest> request, ProfileResponse<ServletResponse> response) {
- ShibbolethSSORequestContext requestContext = new ShibbolethSSORequestContext(request, response);
+ HTTPInTransport in, HTTPOutTransport out) throws ProfileException {
+ ShibbolethSSORequestContext requestContext = new ShibbolethSSORequestContext();
+ requestContext.setCommunicationProfileId(getProfileId());
+
+ requestContext.setMessageDecoder(getMessageDecoders().get(getInboundBinding()));
requestContext.setLoginContext(loginContext);
+ requestContext.setRelayState(loginContext.getSpTarget());
- requestContext.setPrincipalName(loginContext.getPrincipalName());
+ requestContext.setInboundMessageTransport(in);
+ requestContext.setInboundSAMLProtocol(ShibbolethConstants.SHIB_SSO_PROFILE_URI);
- requestContext.setPrincipalAuthenticationMethod(loginContext.getAuthenticationMethod());
+ requestContext.setOutboundMessageTransport(out);
+ requestContext.setOutboundSAMLProtocol(SAMLConstants.SAML20P_NS);
+
+ requestContext.setMetadataProvider(getMetadataProvider());
String relyingPartyId = loginContext.getRelyingPartyId();
+ requestContext.setPeerEntityId(relyingPartyId);
+ requestContext.setInboundMessageIssuer(relyingPartyId);
- requestContext.setRelyingPartyId(relyingPartyId);
+ populateRequestContext(requestContext);
- RelyingPartyConfiguration rpConfig = getRelyingPartyConfiguration(relyingPartyId);
- requestContext.setRelyingPartyConfiguration(rpConfig);
+ return requestContext;
+ }
- requestContext.setRelyingPartyRole(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
+ /** {@inheritDoc} */
+ protected void populateRelyingPartyInformation(BaseSAMLProfileRequestContext requestContext)
+ throws ProfileException {
+ super.populateRelyingPartyInformation(requestContext);
- requestContext.setAssertingPartyId(requestContext.getRelyingPartyConfiguration().getProviderId());
+ EntityDescriptor relyingPartyMetadata = requestContext.getPeerEntityMetadata();
+ if (relyingPartyMetadata != null) {
+ requestContext.setPeerEntityRole(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
+ requestContext.setPeerEntityRoleMetadata(relyingPartyMetadata.getSPSSODescriptor(SAMLConstants.SAML11P_NS));
+ }
+ }
- requestContext.setAssertingPartyRole(IDPSSODescriptor.DEFAULT_ELEMENT_NAME);
+ /** {@inheritDoc} */
+ protected void populateAssertingPartyInformation(BaseSAMLProfileRequestContext requestContext)
+ throws ProfileException {
+ super.populateAssertingPartyInformation(requestContext);
- requestContext.setProfileConfiguration((ShibbolethSSOConfiguration) rpConfig
- .getProfileConfiguration(ShibbolethSSOConfiguration.PROFILE_ID));
+ EntityDescriptor localEntityDescriptor = requestContext.getLocalEntityMetadata();
+ if (localEntityDescriptor != null) {
+ requestContext.setLocalEntityRole(IDPSSODescriptor.DEFAULT_ELEMENT_NAME);
+ requestContext.setLocalEntityRoleMetadata(localEntityDescriptor
+ .getIDPSSODescriptor(SAMLConstants.SAML20P_NS));
+ }
+ }
- return requestContext;
+ /** {@inheritDoc} */
+ protected void populateSAMLMessageInformation(BaseSAMLProfileRequestContext requestContext) throws ProfileException {
+ // nothing to do here
+ }
+
+ /**
+ * Selects the appropriate endpoint for the relying party and stores it in the request context.
+ *
+ * @param requestContext current request context
+ *
+ * @return Endpoint selected from the information provided in the request context
+ */
+ protected Endpoint selectEndpoint(BaseSAMLProfileRequestContext requestContext) {
+ ShibbolethSSOLoginContext loginContext = ((ShibbolethSSORequestContext) requestContext).getLoginContext();
+
+ ShibbolethSSOEndpointSelector endpointSelector = new ShibbolethSSOEndpointSelector();
+ endpointSelector.setSpAssertionConsumerService(loginContext.getSpAssertionConsumerService());
+ endpointSelector.setEndpointType(AssertionConsumerService.DEFAULT_ELEMENT_NAME);
+ endpointSelector.setMetadataProvider(getMetadataProvider());
+ endpointSelector.setEntityMetadata(requestContext.getPeerEntityMetadata());
+ endpointSelector.setEntityRoleMetadata(requestContext.getPeerEntityRoleMetadata());
+ endpointSelector.setSamlRequest(requestContext.getInboundSAMLMessage());
+ endpointSelector.getSupportedIssuerBindings().addAll(getSupportedOutboundBindings());
+
+ Endpoint endpoint = endpointSelector.selectEndpoint();
+ if (endpoint == null && loginContext.getSpAssertionConsumerService() != null) {
+ endpoint = endpointBuilder.buildObject();
+ endpoint.setLocation(loginContext.getSpAssertionConsumerService());
+ endpoint.setBinding(getSupportedOutboundBindings().get(0));
+ log.warn("No endpoint available for relying party {}. Generating endpoint with ACS url {} and binding {}",
+ new Object[] { requestContext.getPeerEntityId(), endpoint.getLocation(), endpoint.getBinding() });
+ }
+
+ return endpoint;
}
/**
throws ProfileException {
ShibbolethSSOLoginContext loginContext = requestContext.getLoginContext();
- AuthenticationStatement statement = getAuthenticationStatementBuilder().buildObject();
+ AuthenticationStatement statement = authnStatementBuilder.buildObject();
statement.setAuthenticationInstant(loginContext.getAuthenticationInstant());
statement.setAuthenticationMethod(loginContext.getAuthenticationMethod());
- // TODO
- statement.setSubjectLocality(null);
+ statement.setSubjectLocality(buildSubjectLocality(requestContext));
- Subject statementSubject = buildSubject(requestContext, "urn:oasis:names:tc:SAML:1.0:cm:sender-vouches");
+ Subject statementSubject = buildSubject(requestContext, "urn:oasis:names:tc:SAML:1.0:cm:bearer");
statement.setSubject(statementSubject);
return statement;
}
/**
- * Encodes the request's SAML response and writes it to the servlet response.
+ * Constructs the subject locality for the authentication statement.
*
- * @param requestContext current request context
+ * @param requestContext curent request context
*
- * @throws ProfileException thrown if no message encoder is registered for this profiles binding
+ * @return subject locality for the authentication statement
*/
- protected void encodeResponse(ShibbolethSSORequestContext requestContext) throws ProfileException {
- if (log.isDebugEnabled()) {
- log.debug("Encoding response to SAML request from relying party " + requestContext.getRelyingPartyId());
- }
- MessageEncoder<ServletResponse> encoder = getMessageEncoderFactory().getMessageEncoder(encodingBinding);
- if (encoder == null) {
- throw new ProfileException("No response encoder was registered for binding type: " + encodingBinding);
- }
+ protected SubjectLocality buildSubjectLocality(ShibbolethSSORequestContext requestContext) {
+ SubjectLocality subjectLocality = subjectLocalityBuilder.buildObject();
- super.populateMessageEncoder(encoder);
- encoder.setResponse(requestContext.getProfileResponse().getRawResponse());
- encoder.setSamlMessage(requestContext.getSamlResponse());
- requestContext.setMessageEncoder(encoder);
+ HTTPInTransport inTransport = (HTTPInTransport) requestContext.getInboundMessageTransport();
+ subjectLocality.setIPAddress(inTransport.getPeerAddress());
- try {
- encoder.encode();
- } catch (BindingException e) {
- throw new ProfileException("Unable to encode response to relying party: "
- + requestContext.getRelyingPartyId(), e);
- }
+ return subjectLocality;
}
/** Represents the internal state of a Shibboleth SSO Request while it's being processed by the IdP. */
- protected class ShibbolethSSORequestContext extends
- SAML1ProfileRequestContext<SAMLObject, Response, ShibbolethSSOConfiguration> {
+ public class ShibbolethSSORequestContext extends
+ BaseSAML1ProfileRequestContext<Request, Response, ShibbolethSSOConfiguration> {
+
+ /** SP-provide assertion consumer service URL. */
+ private String spAssertionConsumerService;
/** Current login context. */
private ShibbolethSSOLoginContext loginContext;
/**
- * Constructor.
- *
- * @param request current profile request
- * @param response current profile response
- */
- public ShibbolethSSORequestContext(ProfileRequest<ServletRequest> request,
- ProfileResponse<ServletResponse> response) {
- super(request, response);
- }
-
- /**
* Gets the current login context.
*
* @return current login context
public void setLoginContext(ShibbolethSSOLoginContext context) {
loginContext = context;
}
+
+ /**
+ * Gets the SP-provided assertion consumer service URL.
+ *
+ * @return SP-provided assertion consumer service URL
+ */
+ public String getSpAssertionConsumerService() {
+ return spAssertionConsumerService;
+ }
+
+ /**
+ * Sets the SP-provided assertion consumer service URL.
+ *
+ * @param acs SP-provided assertion consumer service URL
+ */
+ public void setSpAssertionConsumerService(String acs) {
+ spAssertionConsumerService = acs;
+ }
}
}
\ No newline at end of file