aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java
diff options
context:
space:
mode:
authorBojan Suzic <bojan.suzic@iaik.tugraz.at>2014-02-19 15:48:32 +0100
committerBojan Suzic <bojan.suzic@iaik.tugraz.at>2014-02-19 15:48:32 +0100
commit17eb279fb70ec2e1057db7b4377f34b6ad6c844b (patch)
treed97cdd7e83a8100afcdbe112145585e88119d109 /id/server/idserverlib/src/main/java
parentad0a0adca1ab94f42ed65d9ccf2c68e283a728aa (diff)
downloadmoa-id-spss-17eb279fb70ec2e1057db7b4377f34b6ad6c844b.tar.gz
moa-id-spss-17eb279fb70ec2e1057db7b4377f34b6ad6c844b.tar.bz2
moa-id-spss-17eb279fb70ec2e1057db7b4377f34b6ad6c844b.zip
refactoring names
Diffstat (limited to 'id/server/idserverlib/src/main/java')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java21
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOASTORKAuthnRequest.java (renamed from id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKAuthnRequestDEL.java)4
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKAuthnReq.java105
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java10
4 files changed, 14 insertions, 126 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 2debe7452..0724b744f 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
@@ -15,17 +15,12 @@ import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants;
-import org.opensaml.xml.util.Base64;
-import org.opensaml.xml.util.XMLHelper;
-import javax.servlet.ServletOutputStream;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.*;
import java.util.ArrayList;
-import java.util.HashMap;
-import eu.stork.peps.auth.engine.SAMLEngine;
-import sun.rmi.runtime.Log;
/**
@@ -51,10 +46,10 @@ public class AuthenticationRequest implements IAction {
Logger.debug("Moa session: " + moasession.toString() + " " + moasession.getOAURLRequested() + " " + moasession.getPublicOAURLPrefix() + " " + moasession.getAction() + " " + moasession.getIdentityLink().getName() + " " + moasession.getTarget());
httpResp.reset();
//httpResp.addHeader("Location", "http:/www.google.com");
- if (req instanceof STORKAuthnRequestDEL) {
+ if (req instanceof MOASTORKAuthnRequest) {
/*
- Logger.debug("STORK QAA 2 :" + ((STORKAuthnRequestDEL) req).getStorkAuthnRequest().getQAALevel());
- StartAuthResponse startAuthResponse = getStartAuthResponse(((STORKAuthnRequestDEL) req).getStorkAuthnRequest());
+ Logger.debug("STORK QAA 2 :" + ((MOASTORKAuthnRequest) req).getStorkAuthnRequest().getQAALevel());
+ StartAuthResponse startAuthResponse = getStartAuthResponse(((MOASTORKAuthnRequest) req).getStorkAuthnRequest());
HttpSession httpSession = httpReq.getSession();
httpSession.setAttribute("STORKSessionID", "12345");
@@ -97,7 +92,7 @@ public class AuthenticationRequest implements IAction {
authnResponse.setCountry("AT");
- IPersonalAttributeList attrLst = ((STORKAuthnRequestDEL)req).getStorkAuthnRequest().getPersonalAttributeList();
+ IPersonalAttributeList attrLst = ((MOASTORKAuthnRequest)req).getStorkAuthnRequest().getPersonalAttributeList();
Logger.info("Found number of authnreq personal attributes: " + attrLst.size());
try {
@@ -144,7 +139,7 @@ public class AuthenticationRequest implements IAction {
//Get SAMLEngine instance
STORKSAMLEngine engine = STORKSAMLEngine.getInstance("incoming");
Logger.debug("Starting generation of SAML response");
- authnResponse = engine.generateSTORKAuthnResponse(((STORKAuthnRequestDEL)req).getStorkAuthnRequest(),authnResponse,httpReq.getRemoteAddr(),false);
+ authnResponse = engine.generateSTORKAuthnResponse(((MOASTORKAuthnRequest)req).getStorkAuthnRequest(),authnResponse,httpReq.getRemoteAddr(),false);
//generateSAML Token
Logger.info("SAML response succesfully generated!");
}catch(STORKSAMLEngineException e){
@@ -181,8 +176,8 @@ public class AuthenticationRequest implements IAction {
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("Putting assertion consumer url as action: " + ((MOASTORKAuthnRequest)req).getStorkAuthnRequest().getAssertionConsumerServiceURL());
+ context.put("action", ((MOASTORKAuthnRequest) req).getStorkAuthnRequest().getAssertionConsumerServiceURL());
Logger.debug("Starting template merge");
StringWriter writer = new StringWriter();
//PrintWriter pwriter = new StringWriter();
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKAuthnRequestDEL.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOASTORKAuthnRequest.java
index c8a5ac84d..7c88e25d6 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKAuthnRequestDEL.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOASTORKAuthnRequest.java
@@ -8,9 +8,9 @@ import org.opensaml.common.xml.SAMLConstants;
* @author bsuzic
* Date: 12/4/13, Time: 6:31 PM
*/
-//public class STORKAuthnRequestDEL extends STORKAuthnRequestImpl implements IRequest {
+//public class MOASTORKAuthnRequest extends STORKAuthnRequestImpl implements IRequest {
-public class STORKAuthnRequestDEL implements IRequest {
+public class MOASTORKAuthnRequest implements IRequest {
private String requestID;
private String target = null;
String module = null;
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKAuthnReq.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKAuthnReq.java
deleted file mode 100644
index 54072b6a3..000000000
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKAuthnReq.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package at.gv.egovernment.moa.id.protocols.stork2;
-
-import at.gv.egovernment.moa.id.moduls.IRequest;
-import at.gv.egovernment.moa.id.protocols.pvp2x.binding.MOAURICompare;
-import at.gv.egovernment.moa.logging.Logger;
-import eu.stork.peps.auth.commons.STORKAuthnRequest;
-import org.opensaml.common.binding.BasicSAMLMessageContext;
-import org.opensaml.saml2.binding.decoding.HTTPPostDecoder;
-import org.opensaml.ws.transport.http.HTTPInTransport;
-
-
-/**
- * @author bsuzic
- * Date: 1/22/14, Time: 5:30 PM
- */
-public class STORKAuthnReq implements IRequest {
- private String requestID;
- private String target = null;
- String module = null;
- String action = null;
- private STORKAuthnRequest storkAuthnRequest;
-
- public void setSTORKAuthnRequest(STORKAuthnRequest request) {
- this.storkAuthnRequest = request;
- }
-
- public STORKAuthnRequest getStorkAuthnRequest() {
- return this.storkAuthnRequest;
- }
-
- public void createStorkReq(HTTPInTransport profileReq) {
- Logger.debug("Generate stork request test...");
- storkAuthnRequest = new STORKAuthnRequest();
-
- BasicSAMLMessageContext samlMessageContext = new BasicSAMLMessageContext();
- samlMessageContext.setInboundMessageTransport(profileReq);
-
- HTTPPostDecoder postDecoder = new HTTPPostDecoder();
- postDecoder.setURIComparator(new MOAURICompare()); // TODO Abstract to use general comparator
-
- try {
- Logger.debug("Attempting to decode request...");
- postDecoder.decode(samlMessageContext);
- } catch (Exception e) {
- Logger.error("Error decoding STORKAuthnRequest", e);
- }
-
-
-
- //storkAuthnRequest = (STORKAuthnRequest)samlMessageContext.getInboundSAMLMessage();
- //samlMessageContext.getinbound
- //storkAuthnRequest.set
-
-
-
- }
-
-
-
- public String getOAURL() {
- return "https://sp:8889/SP"; //
- }
-
- public boolean isPassiv() {
- return false; //
- }
-
- public boolean forceAuth() {
- return false; //
- }
-
- public boolean isSSOSupported() {
- return false; //
- }
-
- public String requestedModule() {
- return this.module; //
- }
-
- public String requestedAction() {
- return action; //
- }
-
- public void setModule(String module) {
- this.module = module;
- }
-
- public void setAction(String action) {
- this.action = action;
- }
-
- public String getTarget() {
- return this.target; //
- }
-
- public void setRequestID(String id) {
- this.requestID = id;
- }
-
- public String getRequestID() {
- return this.requestID; //
- }
-
-
-}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java
index 9564afa27..5611c9269 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java
@@ -1,6 +1,5 @@
package at.gv.egovernment.moa.id.protocols.stork2;
-import at.gv.egovernment.moa.id.auth.AuthenticationServer;
import at.gv.egovernment.moa.id.auth.MOAIDAuthConstants;
import at.gv.egovernment.moa.id.auth.exception.MOAIDException;
import at.gv.egovernment.moa.id.moduls.IAction;
@@ -9,7 +8,6 @@ import at.gv.egovernment.moa.id.moduls.IRequest;
import at.gv.egovernment.moa.id.protocols.pvp2x.binding.MOAURICompare;
import at.gv.egovernment.moa.logging.Logger;
import eu.stork.peps.auth.commons.PEPSUtil;
-import eu.stork.peps.auth.commons.STORKAuthnResponse;
import eu.stork.peps.auth.engine.STORKSAMLEngine;
import eu.stork.peps.exceptions.STORKSAMLEngineException;
import org.opensaml.common.binding.BasicSAMLMessageContext;
@@ -107,8 +105,8 @@ public class STORKProtocol implements IModulInfo, MOAIDAuthConstants {
/*
STORKAuthnRequestImpl ST2Req = (STORKAuthnRequestImpl)samlMessageContext.getInboundSAMLMessage();
- //STORKAuthnRequestDEL STORK2Request = (STORKAuthnRequestDEL)samlMessageContext.getInboundSAMLMessage();
- STORKAuthnRequestDEL STORK2Request = new STORKAuthnRequestDEL();
+ //MOASTORKAuthnRequest STORK2Request = (MOASTORKAuthnRequest)samlMessageContext.getInboundSAMLMessage();
+ MOASTORKAuthnRequest STORK2Request = new MOASTORKAuthnRequest();
STORK2Request.setSTORKAuthnRequest(ST2Req);
Logger.debug("STORK2 Citizen code: " + ST2Req.getCitizenCountryCode());
@@ -116,10 +114,10 @@ public class STORKProtocol implements IModulInfo, MOAIDAuthConstants {
Logger.debug("STORK2 ISSUER: " + ST2Req.getIssuer().toString());
*/
- STORKAuthnReq storkAuthnReq = new STORKAuthnReq();
+ //STORKAuthnReq storkAuthnReq = new STORKAuthnReq();
- STORKAuthnRequestDEL STORK2Request = new STORKAuthnRequestDEL();
+ MOASTORKAuthnRequest STORK2Request = new MOASTORKAuthnRequest();
//extract STORK Response from HTTP Request