- if (log.isDebugEnabled()) {
- log.debug("begin processRequest");
- }
-
- // check that request/response is of proper type
- if (!(request.getRawRequest() instanceof HttpServletRequest)) {
- throw new ProfileException(HTTPSOAPAttributeQuery.class.getName() + " can only process requests of type "
- + HttpServletRequest.class.getName());
- } else if (!(response.getRawResponse() instanceof HttpServletResponse)) {
- throw new ProfileException(HTTPSOAPAttributeQuery.class.getName() + " can only process responses of type "
- + HttpServletResponse.class.getName());
- }
-
- // create decoder
- HTTPSOAP11Decoder decoder = new HTTPSOAP11Decoder();
- decoder.setMetadataProvider(getMetadataProvider());
- // TODO decoder.setSecurityPolicy(policy);
- // TODO decoder.setTrustEngine(newEngine);
-
- // get message from the decoder
- org.opensaml.saml2.core.AttributeQuery message = null;
- try {
- decoder.setRequest((HttpServletRequest) request.getRawRequest());
- decoder.decode();
- if (log.isDebugEnabled()) {
- log.debug("decoded http servlet request");
- }
- message = (org.opensaml.saml2.core.AttributeQuery) decoder.getSAMLMessage();
- } catch (BindingException e) {
- log.error("Error decoding attribute query message", e);
- throw new ProfileException("Error decoding attribute query message");
- }
-
- // get the provider id from the message issuer
- String providerId = message.getIssuer().getSPProvidedID();
-
- // TODO get user data from the session, need sessionId
- // ?? getSessionManager().getSession(null).getServicesInformation().get(0);
- ServiceInformation serviceInformation = null;
- String principalName = serviceInformation.getSubjectNameID().getSPProvidedID();
- String authenticationMethod = serviceInformation.getAuthenticationMethod().getAuthenticationMethod();
-
- // create attribute request for the attribute authority
- ShibbolethAttributeRequestContext requestContext = null;
- try {
- requestContext = new ShibbolethAttributeRequestContext(getMetadataProvider(),
- getRelyingPartyConfiguration(providerId));
- requestContext.setPrincipalName(principalName);
- requestContext.setPrincipalAuthenticationMethod(authenticationMethod);
- requestContext.setRequest(request.getRawRequest());
- } catch (MetadataProviderException e) {
- log.error("Error creating ShibbolethAttributeRequestContext", e);
- throw new ProfileException("Error retrieving metadata", e);
- }