Skip to Content.
Sympa Menu

mace-opensaml-users - HttpPostEncoder and HttpPostDecoder

Subject: OpenSAML user discussion

List archive

HttpPostEncoder and HttpPostDecoder


Chronological Thread 
  • From: rangeli nepal <>
  • To:
  • Subject: HttpPostEncoder and HttpPostDecoder
  • Date: Sun, 16 May 2010 23:22:22 -0400
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=LAifU5NvAOHL0LG7Jm0qoUNgxQcpDWOJVxV8vHE9OdRb1rdF03BskxQptL8LzIlvAt e7QdY4yTXO5kV+dIh2GaI2z8nIadMHeoWuHnOdLu6Uj8HicDy4//llypxq3JqpU6ZlGF abRpJDxZFhQsdyfpJpyFYt+9se5PpzwKyvwFk=

Hello Everybody,

In order to test Post Binding I wrote a small test program using HttpPostEncoder. In oder to decode on server end I am using HttpPostDecoder. However I get following error:

23:15:22,938 DEBUG [Configuration] VM using JAXP parser org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
23:15:22,949 DEBUG [BaseMessageDecoder] Beginning to decode message from inbound transport of type: org.opensaml.ws.transport.http.HttpServletRequestAdapter
23:15:22,950 DEBUG [HTTPPostDecoder] Decoded SAML relay state of: null
23:15:22,950 DEBUG [HTTPPostDecoder] Getting Base64 encoded message from request
23:15:22,950 ERROR [HTTPPostDecoder] Request did not contain either a SAMLRequest or SAMLResponse paramter.  Invalid request for SAML 2 HTTP POST binding.
23:15:22,952 ERROR [STDERR] org.opensaml.ws.message.decoder.MessageDecodingException: No SAML message present in request

am I doing something wrong.? Your input will be highly appreciated.
Thank you.
rn


Encoding end looks like following:

public FooHTTPPostEncoder( String templateId,String key,String cert, HttpServletResponse response ) throws Exception
{
   velocityEngine = new VelocityEngine();
       velocityEngine.setProperty(RuntimeConstants.ENCODING_DEFAULT, "UTF-8");
       velocityEngine.setProperty(RuntimeConstants.OUTPUT_ENCODING, "UTF-8");
       velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
       velocityEngine.setProperty("classpath.resource.loader.class",
               "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
       velocityEngine.init();
       this.setTemplateString(templateId);
   
   ................................
        ............................
                < build AuthnRequest using available builders>
 
        authnRequest=samlAuthnRequest.buildAuthnRequest();
 this.basicSAMLMessageContext=new BasicSAMLMessageContext();
 Endpoint endPoint=samlAuthnRequest.getEndPoint(this.actionURL);
 
 this.basicSAMLMessageContext.setPeerEntityEndpoint(endPoint);
 this.basicSAMLMessageContext.setOutboundSAMLMessage(authnRequest);
  
 HttpServletResponseAdapter adapter = new HttpServletResponseAdapter(response,false);
 this.basicSAMLMessageContext.setOutboundMessageTransport(adapter);
 this.basicSAMLMessageContext.setOutboundSAMLMessageSigningCredential(this.samlAuthnRequest.getSamlCommon().getCredential());
       
}
     public String getTemplateString()
{
return templateString;
}
public void setTemplateString( String templateString)
{
this.templateString = templateString;
}
public void encode() throws MessageEncodingException{
     HTTPPostEncoder encoder = new HTTPPostEncoder(velocityEngine,
         this.templateString);
         encoder.encode(this.basicSAMLMessageContext);
     }

Decoding:

                HTTPPostDecoder decode = new HTTPPostDecoder( new BasicParserPool() );
       HttpServletRequestAdapter adapter = new HttpServletRequestAdapter(request);
       context = new BasicSAMLMessageContext();
        context.setInboundMessageTransport(adapter);
                 decode.decode(context);
     
      samlRequest = (AuthnRequest) context.getInboundMessage();



Archive powered by MHonArc 2.6.16.

Top of Page