aboutsummaryrefslogtreecommitdiff
path: root/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa')
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/ConfigurationProperties.java12
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/service/EhvdCommunicationService.java32
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/service/IEhvdCommunication.java7
-rw-r--r--id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/task/InjectEhvdInformationTask.java10
4 files changed, 52 insertions, 9 deletions
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/ConfigurationProperties.java b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/ConfigurationProperties.java
index 035e59387..d1f7c47b2 100644
--- a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/ConfigurationProperties.java
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/ConfigurationProperties.java
@@ -42,6 +42,18 @@ public class ConfigurationProperties {
public static final String DEFAULT_EHVD_SERVICE_TARGET = EAAFConstants.URN_PREFIX_CDID + "GH";
+
+ //TODO: define custom EHVD SAML2 attributes
+ public static final String ATTRIBUTE_URN_EHVD_PREFIX = "urn:brzgvat:attributes.ehvd.";
+ public static final String ATTRIBUTE_URN_EHVD_TITLE = ATTRIBUTE_URN_EHVD_PREFIX + "title";
+ public static final String ATTRIBUTE_URN_EHVD_FIRSTNAME = ATTRIBUTE_URN_EHVD_PREFIX + "firstname";
+ public static final String ATTRIBUTE_URN_EHVD_SURNAME = ATTRIBUTE_URN_EHVD_PREFIX + "surname";
+ public static final String ATTRIBUTE_URN_EHVD_ZIPCODE = ATTRIBUTE_URN_EHVD_PREFIX + "zip";
+ public static final String ATTRIBUTE_URN_EHVD_STATE = ATTRIBUTE_URN_EHVD_PREFIX + "state";
+ public static final String ATTRIBUTE_URN_EHVD_ID = ATTRIBUTE_URN_EHVD_PREFIX + "id";
+ public static final String ATTRIBUTE_URN_EHVD_OTHERID = ATTRIBUTE_URN_EHVD_PREFIX + "otherid";
+
+
private ConfigurationProperties() {
// hide constructor or static class
}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/service/EhvdCommunicationService.java b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/service/EhvdCommunicationService.java
index 900adaff7..cf58fe718 100644
--- a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/service/EhvdCommunicationService.java
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/service/EhvdCommunicationService.java
@@ -83,7 +83,7 @@ public class EhvdCommunicationService implements IEhvdCommunication {
*/
@Override
@Nonnull
- public List<String> getRoles(IIdentityLink identityLink) throws AuthenticationException,
+ public EhvdResponseHolder getRoles(IIdentityLink identityLink) throws AuthenticationException,
EAAFBuilderException {
// get bPK for EHVD request
@@ -96,7 +96,7 @@ public class EhvdCommunicationService implements IEhvdCommunication {
final GdaIndexResponse gdaResp = requestingGda(ehvdBpk.getFirst());
// parse roles from response
- return parseGdaResponse(gdaResp);
+ return EhvdResponseHolder.getInstance(gdaResp.getGda(), parseGdaResponse(gdaResp));
}
@@ -287,7 +287,33 @@ public class EhvdCommunicationService implements IEhvdCommunication {
http.getClient().setProxyServerPort(Integer.valueOf(socksPort));
}
-
}
+ public static class EhvdResponseHolder {
+ final List<String> roles;
+ final GdaDescriptor fullGdaResponse;
+
+
+ public static EhvdResponseHolder getInstance(GdaDescriptor gdaInfo, List<String> processedRoles) {
+ return new EhvdResponseHolder(gdaInfo, processedRoles);
+
+ }
+
+ private EhvdResponseHolder(GdaDescriptor gdaInfo, List<String> processedRoles) {
+ this.roles = processedRoles;
+ this.fullGdaResponse = gdaInfo;
+
+ }
+
+ public List<String> getRoles() {
+ return roles;
+ }
+
+ public GdaDescriptor getFullGdaResponse() {
+ return fullGdaResponse;
+ }
+
+
+
+ }
}
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/service/IEhvdCommunication.java b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/service/IEhvdCommunication.java
index 2d9291ed7..6b7c7e2f5 100644
--- a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/service/IEhvdCommunication.java
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/service/IEhvdCommunication.java
@@ -1,10 +1,9 @@
package at.gv.egovernment.moa.id.auth.modules.ehvd.service;
-import java.util.List;
-
import at.gv.egiz.eaaf.core.api.idp.auth.data.IIdentityLink;
import at.gv.egiz.eaaf.core.exceptions.EAAFBuilderException;
import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.service.EhvdCommunicationService.EhvdResponseHolder;
public interface IEhvdCommunication {
@@ -12,10 +11,10 @@ public interface IEhvdCommunication {
* Get user's GDA roles from EHVD Service.
*
* @param identityLink IdentityLink of the user
- * @return {@link List} of Roles that are received from EHVD
+ * @return {@link EhvdResponseHolder} that contains the Roles received from EHVD and the full GDA response
* @throws AuthenticationException In case of an EHVD communication error
* @throws EAAFBuilderException In case of a bPK generation error
*/
- List<String> getRoles(IIdentityLink identityLink) throws AuthenticationException, EAAFBuilderException;
+ EhvdResponseHolder getRoles(IIdentityLink identityLink) throws AuthenticationException, EAAFBuilderException;
} \ No newline at end of file
diff --git a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/task/InjectEhvdInformationTask.java b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/task/InjectEhvdInformationTask.java
index 8f22c6ffc..ee5dbb2fd 100644
--- a/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/task/InjectEhvdInformationTask.java
+++ b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/task/InjectEhvdInformationTask.java
@@ -37,6 +37,8 @@ import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
import at.gv.egiz.eaaf.core.impl.idp.auth.modules.AbstractAuthServletTask;
import at.gv.egovernment.moa.id.auth.data.AuthenticationSessionWrapper;
import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.ConfigurationProperties;
+import at.gv.egovernment.moa.id.auth.modules.ehvd.service.EhvdCommunicationService.EhvdResponseHolder;
import at.gv.egovernment.moa.id.auth.modules.ehvd.service.IEhvdCommunication;
import at.gv.egovernment.moa.id.commons.api.exceptions.MOAIDException;
import at.gv.egovernment.moa.logging.Logger;
@@ -72,12 +74,16 @@ public class InjectEhvdInformationTask extends AbstractAuthServletTask {
validateInternalState(session);
// requesting roles from EHVD
- final List<String> ehvdRoles = ehvdService.getRoles(session.getIdentityLink());
+ final EhvdResponseHolder ehvdResponse = ehvdService.getRoles(session.getIdentityLink());
// inject EHVD roles
session.setGenericDataToSession(PVPAttributeDefinitions.ROLES_NAME,
- StringUtils.join(ehvdRoles, ";"));
+ StringUtils.join(ehvdResponse.getRoles(), ";"));
+ // inject full EHVD response
+ session.setGenericDataToSession(ConfigurationProperties.ATTRIBUTE_URN_EHVD_PREFIX,
+ ehvdResponse.getFullGdaResponse());
+
// store MOASession into database
requestStoreage.storePendingRequest(pendingReq);