diff options
| author | Bojan Suzic <bojan.suzic@iaik.tugraz.at> | 2014-02-25 20:34:44 +0100 | 
|---|---|---|
| committer | Bojan Suzic <bojan.suzic@iaik.tugraz.at> | 2014-02-25 20:34:44 +0100 | 
| commit | f51b28c24ac466b5e25d3047975beac8f14d2c15 (patch) | |
| tree | 22c9c275681bcb4e8789f0aee0e637ac4513da51 | |
| parent | 8d438e785622695d55dbff05f8383447ff4eb251 (diff) | |
| download | moa-id-spss-f51b28c24ac466b5e25d3047975beac8f14d2c15.tar.gz moa-id-spss-f51b28c24ac466b5e25d3047975beac8f14d2c15.tar.bz2 moa-id-spss-f51b28c24ac466b5e25d3047975beac8f14d2c15.zip | |
attrcollector
4 files changed, 38 insertions, 32 deletions
| diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java index 9f1e9cfd8..5fdbe1f77 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OASTORKConfig.java @@ -92,7 +92,7 @@ public class OASTORKConfig {  				// Sorry.  				if (attributeProviderPlugins.isEmpty())  					attributeProviderPlugins.add(new AttributeProviderPlugin()); -				}  } catch (NullPointerException ex) { +				} catch (NullPointerException ex) {                      Logger.error("Nullpointerexception encountered in Configurationinterface");                  }  			} diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java index 08244ab38..cc0f8569e 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java @@ -155,18 +155,7 @@ public class AttributeCollector implements IAction {              //httpSession.setAttribute("CCC", ccc);            */ -        } - - -        //httpResp.setStatus(200); -        //VPEPSInboundPostHandler - -				// - put container in temporary store. -				AssertionStorage.getInstance().put(newArtifactId, container); - -				// add container-key to redirect embedded within the return URL -				e.getAp().performRedirect(AuthConfigurationProvider.getInstance().getPublicURLPrefix() + "?" + ARTIFACT_ID + "=" + newArtifactId, container.getRequest().getCitizenCountryCode(), request, response, oaParam); -			} catch (Exception e1) { +        }  catch (Exception e1) {  				// TODO should we return the response as is to the PEPS?  				Logger.error("Error putting incomplete Stork response into temporary storage", e);  				throw new MOAIDException("stork.11", null); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java index 98d354e8a..9a4c1f59b 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java @@ -31,12 +31,17 @@ public class AttributeProviderFactory {  	 * @return the attribute provider  	 */  	public static AttributeProvider create(String shortname, String url) { -		switch (shortname) { -		case "StorkAttributeRequestProvider": -			return new StorkAttributeRequestProvider(url); -		default: -			return null; -		} +		//switch (shortname) { +		//case "StorkAttributeRequestProvider": +		//	return new StorkAttributeRequestProvider(url); +		//default: +		//	return null; +		//} +        if (shortname.equals("StorkAttributeRequestProvider"))  { +            return new StorkAttributeRequestProvider(url); +        }       else { +            return null; +        }  	}  	/** 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 d742d72ef..6ef85d7ae 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 @@ -1,8 +1,11 @@  package at.gv.egovernment.moa.id.protocols.stork2;  import at.gv.egovernment.moa.id.auth.data.AuthenticationSession; +import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;  import at.gv.egovernment.moa.id.auth.exception.MOAIDException;  import at.gv.egovernment.moa.id.auth.stork.VelocityProvider; +import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider; +import at.gv.egovernment.moa.id.config.auth.OAAuthParameter;  import at.gv.egovernment.moa.id.moduls.IAction;  import at.gv.egovernment.moa.id.moduls.IRequest;  import at.gv.egovernment.moa.id.storage.AssertionStorage; @@ -22,10 +25,7 @@ import javax.servlet.ServletOutputStream;  import javax.servlet.http.HttpServletRequest;  import javax.servlet.http.HttpServletResponse;  import javax.servlet.http.HttpSession; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; +import java.io.*;  import java.util.HashMap;  import eu.stork.peps.auth.engine.SAMLEngine; @@ -94,6 +94,13 @@ public class AuthenticationRequest implements IAction {            */          } +        STORKAuthnResponse authnResponse = new STORKAuthnResponse(); +        authnResponse.setCountry("AT"); + +        OAAuthParameter oaParam = AuthConfigurationProvider.getInstance().getOnlineApplicationParameter(moasession.getPublicOAURLPrefix()); +        if (oaParam == null) +            throw new AuthenticationException("stork.12", new Object[] { moasession.getPublicOAURLPrefix() }); +          //httpResp.setStatus(200);          //VPEPSInboundPostHandler @@ -102,20 +109,23 @@ public class AuthenticationRequest implements IAction {          DataContainer container = new DataContainer();          // - fill in the request we extracted above -        container.setRequest(request); +        container.setRequest(((MOASTORKAuthnRequest) req).getStorkAuthnRequest());          // - fill in the partial response created above -        container.setResponse(response); +        container.setResponse(authnResponse);          // - memorize the target url were we have to return the result -        container.setTarget(target); -         +        container.setTarget(((MOASTORKAuthnRequest) req).getStorkAuthnRequest().getAssertionConsumerServiceURL()); + + + + +        if (1==1) // test          // see if we need to fetch further attributes -        return (new AttributeCollector()).processRequest(container); +        return (new AttributeCollector()).processRequest(container, httpReq, httpResp, oaParam); + -        STORKAuthnResponse authnResponse = new STORKAuthnResponse(); -        authnResponse.setCountry("AT"); @@ -163,13 +173,15 @@ public class AuthenticationRequest implements IAction {          try {              Logger.debug("authn saml plain:" + authnResponse.getTokenSaml()); -            Logger.debug("authn saml string:" + new String(authnResponse.getTokenSaml())); // radi +            Logger.debug("authn saml string:" + new String(authnResponse.getTokenSaml())); // works              Logger.debug("authn saml encodedx: " + new String(org.bouncycastle.util.encoders.Base64.encode(IOUtils.toString(authnResponse.getTokenSaml()).getBytes())));          } catch (IOException e) {              e.printStackTrace();          } +        // preparing redirection for the client +          try {              VelocityEngine velocityEngine = VelocityProvider.getClassPathVelocityEngine();              Template template = velocityEngine.getTemplate("/resources/templates/stork2_postbinding_template.html"); @@ -266,7 +278,7 @@ public class AuthenticationRequest implements IAction {      //    moaAttributeProvider.populateAttribute(attributeList, "dateOfBirth"); -        return authResponse; +        return attributeList;      }      public String getDefaultActionName() { | 
