aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv
diff options
context:
space:
mode:
authorBojan Suzic <bojan.suzic@iaik.tugraz.at>2014-02-27 15:14:32 +0100
committerBojan Suzic <bojan.suzic@iaik.tugraz.at>2014-02-27 15:14:32 +0100
commit433e76b8b63b20a1d28f876f32a04f14342a9092 (patch)
treee9ffcb1acf902c6cd6ad5eb2ae40550fa81e06a3 /id/server/idserverlib/src/main/java/at/gv
parentce0962d20a720e6c16adfd89ee8d71639d65dd52 (diff)
downloadmoa-id-spss-433e76b8b63b20a1d28f876f32a04f14342a9092.tar.gz
moa-id-spss-433e76b8b63b20a1d28f876f32a04f14342a9092.tar.bz2
moa-id-spss-433e76b8b63b20a1d28f876f32a04f14342a9092.zip
integrating stork eidattribute
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/BPKBuilder.java10
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java8
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOAAttributeProvider.java15
3 files changed, 23 insertions, 10 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/BPKBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/BPKBuilder.java
index fd8f3f875..fc43d25e5 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/BPKBuilder.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/BPKBuilder.java
@@ -141,9 +141,9 @@ public class BPKBuilder {
* @return storkid in a BASE64 encoding
* @throws BuildException if an error occurs on building the wbPK
*/
- public String buildStorkPK(String identificationValue, String destinationCountry)
+ public String buildStorkbPK(String identificationValue, String destinationCountry)
throws BuildException {
- return buildStorkPK(identificationValue, "AT", destinationCountry);
+ return buildStorkbPK(identificationValue, "AT", destinationCountry);
}
@@ -156,17 +156,15 @@ public class BPKBuilder {
* @return storkid in a BASE64 encoding
* @throws BuildException if an error occurs on building the wbPK
*/
- public String buildStorkPK(String identificationValue, String sourceCountry, String destinationCountry)
+ public String buildStorkbPK(String identificationValue, String sourceCountry, String destinationCountry)
throws BuildException {
if ((identificationValue == null ||
identificationValue.length() == 0 ||
destinationCountry == null ||
destinationCountry.length() == 0 ||
- destinationCountry.length() != 2 ||
sourceCountry == null ||
- sourceCountry.length() == 0 ||
- sourceCountry.length() != 2)) {
+ sourceCountry.length() == 0)) {
throw new BuildException("builder.00",
new Object[]{"storkid", "Unvollständige Parameterangaben: identificationValue=" +
identificationValue + ", Zielland=" + destinationCountry + ", Ursprungsland=" + sourceCountry});
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 3288e064f..6a2fe3bfc 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
@@ -54,6 +54,7 @@ public class AuthenticationRequest implements IAction {
this.moaSession = moasession;
this.moaStorkAuthnRequest = (MOASTORKAuthnRequest)req;
+ try{
MISMandate mandate = moasession.getMISMandate();
String owbpk = mandate.getOWbPK();
byte[] mand = mandate.getMandate();
@@ -63,6 +64,7 @@ public class AuthenticationRequest implements IAction {
Logger.debug("mandate encoded: " + new String(org.bouncycastle.util.encoders.Base64.encode(mand)));
+} catch (Exception x) {}
Logger.debug("Starting AuthenticationRequest");
//AuthenticationServer.getInstance().startSTORKAuthentication(httpReq, httpResp, moasession);
@@ -72,7 +74,9 @@ public class AuthenticationRequest implements IAction {
httpResp.reset();
STORKAuthnResponse authnResponse = new STORKAuthnResponse();
- authnResponse.setCountry("EU");
+ authnResponse.setCountry(((MOASTORKAuthnRequest)req).getStorkAuthnRequest().getSpCountry());
+
+
OAAuthParameter oaParam = AuthConfigurationProvider.getInstance().getOnlineApplicationParameter(moasession.getPublicOAURLPrefix());
if (oaParam == null)
@@ -137,7 +141,7 @@ public class AuthenticationRequest implements IAction {
// Define attribute list to be populated
PersonalAttributeList attributeList = new PersonalAttributeList();
- MOAAttributeProvider moaAttributeProvider = new MOAAttributeProvider(moaSession.getIdentityLink());
+ MOAAttributeProvider moaAttributeProvider = new MOAAttributeProvider(moaSession.getIdentityLink(), moaStorkAuthnRequest);
try {
for (PersonalAttribute personalAttribute : attrLst) {
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOAAttributeProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOAAttributeProvider.java
index 414e383fa..190a0d27c 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOAAttributeProvider.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MOAAttributeProvider.java
@@ -1,6 +1,8 @@
package at.gv.egovernment.moa.id.protocols.stork2;
+import at.gv.egovernment.moa.id.auth.builder.BPKBuilder;
import at.gv.egovernment.moa.id.auth.data.IdentityLink;
+import at.gv.egovernment.moa.id.auth.exception.BuildException;
import at.gv.egovernment.moa.logging.Logger;
import eu.stork.peps.auth.commons.PersonalAttribute;
import eu.stork.peps.auth.commons.PersonalAttributeList;
@@ -20,6 +22,7 @@ public class MOAAttributeProvider {
private final IdentityLink identityLink;
private static final Map<String, String> storkAttributeSimpleMapping;
private static final Map<String, String> storkAttributeFunctionMapping;
+ private final MOASTORKAuthnRequest moastorkAuthnRequest;
static {
Map<String, String> tempSimpleMap = new HashMap<String, String>();
@@ -32,8 +35,9 @@ public class MOAAttributeProvider {
storkAttributeFunctionMapping = Collections.unmodifiableMap(tempFunctionMap);
}
- public MOAAttributeProvider(IdentityLink identityLink) {
+ public MOAAttributeProvider(IdentityLink identityLink, MOASTORKAuthnRequest moastorkAuthnRequest) {
this.identityLink = identityLink;
+ this.moastorkAuthnRequest = moastorkAuthnRequest;
Logger.debug("identity " + identityLink.getIdentificationType() + " " + identityLink.getIdentificationValue());
}
@@ -66,9 +70,16 @@ public class MOAAttributeProvider {
}
private String geteIdentifier() {
- return "askdlaskdlaskdsds";
+ Logger.debug("Using base urn for identification value: " + identityLink.getIdentificationType() + " and target country: " + moastorkAuthnRequest.getStorkAuthnRequest().getSpCountry());
+ try {
+ return new BPKBuilder().buildStorkbPK(identityLink.getIdentificationValue(), moastorkAuthnRequest.getStorkAuthnRequest().getSpCountry());
+ } catch (BuildException be) {
+ Logger.error("Stork eid could not be constructed; " + be.getMessage());
+ return null; // TODO error
+ }
}
+
private void populateAttributeWithMethod(Method method, Object object, PersonalAttributeList attributeList, String storkAttribute, Boolean isRequired) {
try {
String attributeValue = method.invoke(object, new Class[]{}).toString();