diff options
author | Bojan Suzic <bojan.suzic@iaik.tugraz.at> | 2014-02-18 16:26:11 +0100 |
---|---|---|
committer | Bojan Suzic <bojan.suzic@iaik.tugraz.at> | 2014-02-18 16:26:11 +0100 |
commit | efa960b616d81e762905b531814560616b98eab4 (patch) | |
tree | 3351154e5055bff1755bb449c2e8eb1a8133f61e | |
parent | 3f038a899c59af76bd4257f95b4fe8a5aa58eadc (diff) | |
download | moa-id-spss-efa960b616d81e762905b531814560616b98eab4.tar.gz moa-id-spss-efa960b616d81e762905b531814560616b98eab4.tar.bz2 moa-id-spss-efa960b616d81e762905b531814560616b98eab4.zip |
saml point
-rw-r--r-- | id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java index 1fa88e0a2..55d5f3626 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java @@ -27,6 +27,7 @@ import java.util.HashMap; import eu.stork.peps.auth.engine.SAMLEngine; import sun.rmi.runtime.Log; + /** * @author bsuzic * Date: 12/3/13, Time: 2:08 PM @@ -142,6 +143,7 @@ public class AuthenticationRequest implements IAction { try { Logger.debug("authn saml:" + IOUtils.toString(authnResponse.getTokenSaml())); + Logger.debug("authn saml encodedx: " + new String(org.bouncycastle.util.encoders.Base64.encode(IOUtils.toString(authnResponse.getTokenSaml()).getBytes()))); } catch (IOException e) { e.printStackTrace(); @@ -153,18 +155,28 @@ public class AuthenticationRequest implements IAction { VelocityContext context = new VelocityContext(); //Logger.info("Putting saml token in response: " + org.bouncycastle.util.encoders.Base64.decode(context.get("SAMLResponse").toString())); - context.put("SAMLResponse", IOUtils.toString(authnResponse.getTokenSaml())); - Logger.info("Putting saml token in response: " + org.bouncycastle.util.encoders.Base64.decode(context.get("SAMLResponse").toString())); + //context.put("SAMLResponse", IOUtils.toString(authnResponse.getTokenSaml())); + + context.put("SAMLResponse", new String(org.bouncycastle.util.encoders.Base64.encode(IOUtils.toString(authnResponse.getTokenSaml()).getBytes()))); + Logger.debug("SAMLResponse original: " + new String(org.bouncycastle.util.encoders.Base64.encode(IOUtils.toString(authnResponse.getTokenSaml()).getBytes()))); + //Logger.info("Putting saml token in response: " + org.bouncycastle.util.encoders.Base64.encode(context.get("SAMLResponse").toString().getBytes())); Logger.debug("Putting assertion consumer url as action: " + ((STORKAuthnRequestDEL)req).getStorkAuthnRequest().getAssertionConsumerServiceURL()); context.put("action", ((STORKAuthnRequestDEL) req).getStorkAuthnRequest().getAssertionConsumerServiceURL()); Logger.debug("Starting template merge"); StringWriter writer = new StringWriter(); + //PrintWriter pwriter = new StringWriter(); + Logger.debug("Doing template merge"); template.merge(context, writer); Logger.debug("Template merge done"); - Logger.debug("Sending html content: " + writer.toString().getBytes()); - httpResp.getOutputStream().write(writer.toString().getBytes()); + + Logger.debug("Sending html content: " + writer.getBuffer().toString()); + Logger.debug("Sending html content2 : " + new String(writer.getBuffer())); + + + + httpResp.getOutputStream().write(writer.getBuffer().toString().getBytes()); } catch (Exception e) { Logger.error("Velocity error: " + e.getMessage()); @@ -172,7 +184,7 @@ public class AuthenticationRequest implements IAction { HttpSession httpSession = httpReq.getSession(); httpSession.setAttribute("STORKSessionID", "12345"); - Logger.info("Status code: " + authnResponse.getStatusCode()); + Logger.info("Status code again: " + authnResponse.getStatusCode()); |