package at.gv.egovernment.moa.id.protocols.pvp2x.binding; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.opensaml.common.SAMLObject; import org.opensaml.common.binding.BasicSAMLMessageContext; import org.opensaml.saml2.binding.decoding.HTTPPostDecoder; import org.opensaml.saml2.core.RequestAbstractType; import org.opensaml.saml2.core.Response; import org.opensaml.ws.message.decoder.MessageDecodingException; import org.opensaml.ws.transport.http.HttpServletRequestAdapter; import org.opensaml.xml.parse.BasicParserPool; import org.opensaml.xml.security.SecurityException; import at.gv.egovernment.moa.id.protocols.pvp2x.PVP2XProtocol; public class PostBinding implements IDecoder, IEncoder { public void encodeRequest(HttpServletRequest req, HttpServletResponse resp, RequestAbstractType request) throws MessageDecodingException, SecurityException{ // TODO Auto-generated method stub } public void encodeRespone(HttpServletRequest req, HttpServletResponse resp, Response response) throws MessageDecodingException, SecurityException{ // TODO Auto-generated method stub } public RequestAbstractType decodeRequest(HttpServletRequest req, HttpServletResponse resp) throws MessageDecodingException, SecurityException{ HTTPPostDecoder decode = new HTTPPostDecoder(new BasicParserPool()); BasicSAMLMessageContext messageContext = new BasicSAMLMessageContext(); messageContext .setInboundMessageTransport(new HttpServletRequestAdapter( req)); decode.decode(messageContext); RequestAbstractType inboundMessage = (RequestAbstractType) messageContext .getInboundMessage(); return inboundMessage; } public Response decodeRespone(HttpServletRequest req, HttpServletResponse resp) throws MessageDecodingException, SecurityException{ HTTPPostDecoder decode = new HTTPPostDecoder(new BasicParserPool()); BasicSAMLMessageContext messageContext = new BasicSAMLMessageContext(); messageContext .setInboundMessageTransport(new HttpServletRequestAdapter( req)); decode.decode(messageContext); Response inboundMessage = (Response) messageContext .getInboundMessage(); return inboundMessage; } public boolean handleDecode(String action) { return (action.equals(PVP2XProtocol.POST)); } }