diff options
author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2021-07-28 11:33:11 +0200 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2021-08-30 10:38:25 +0200 |
commit | ba6ba0af88d8c9472a63356ddf3d19f84847c2d7 (patch) | |
tree | c491da6c530e7c69dc236dfc02f432bc95b9c24c /id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/service/EhvdCommunicationService.java | |
parent | 1b7c56f30ff37596933a904b8ae931be18e9015b (diff) | |
download | moa-id-spss-ba6ba0af88d8c9472a63356ddf3d19f84847c2d7.tar.gz moa-id-spss-ba6ba0af88d8c9472a63356ddf3d19f84847c2d7.tar.bz2 moa-id-spss-ba6ba0af88d8c9472a63356ddf3d19f84847c2d7.zip |
add new authentication module for EHVD communication
Diffstat (limited to 'id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/service/EhvdCommunicationService.java')
-rw-r--r-- | id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/service/EhvdCommunicationService.java | 69 |
1 files changed, 69 insertions, 0 deletions
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 new file mode 100644 index 000000000..f0e2069a1 --- /dev/null +++ b/id/server/modules/moa-id-module-ehvd_integration/src/main/java/at/gv/egovernment/moa/id/auth/modules/ehvd/service/EhvdCommunicationService.java @@ -0,0 +1,69 @@ +package at.gv.egovernment.moa.id.auth.modules.ehvd.service; + +import java.util.Collections; +import java.util.List; + +import javax.annotation.Nonnull; +import javax.annotation.PostConstruct; + +import org.springframework.beans.factory.annotation.Autowired; + +import at.gv.egiz.eaaf.core.api.idp.IConfiguration; +import at.gv.egiz.eaaf.core.api.idp.auth.data.IIdentityLink; +import at.gv.egiz.eaaf.core.exceptions.EAAFBuilderException; +import at.gv.egiz.eaaf.core.impl.data.Pair; +import at.gv.egiz.eaaf.core.impl.idp.auth.builder.BPKBuilder; +import at.gv.egovernment.moa.id.auth.exception.AuthenticationException; +import at.gv.egovernment.moa.id.auth.modules.ehvd.ConfigurationProperties; +import at.gv.egovernment.moa.logging.Logger; + +/** + * Implement interaction with EHVD service to get GDA information. + * + * @author tlenz + * + */ +public class EhvdCommunicationService implements IEhvdCommunication { + + @Autowired IConfiguration config; + + private String ehvdBpkTarget; + + /** + * Get user's GDA roles from EHVD Service. + * + * @param identityLink IdentityLink of the user + * @return {@link List} of Roles that are received from EHVD + * @throws AuthenticationException In case of an EHVD communication error + * @throws EAAFBuilderException In case of a bPK generation error + */ + @Override + @Nonnull + public List<String> getRoles(IIdentityLink identityLink) throws AuthenticationException, EAAFBuilderException { + + // get bPK for EHVD request + Pair<String, String> ehvdBpk = BPKBuilder.generateAreaSpecificPersonIdentifier( + identityLink.getIdentificationValue(), + identityLink.getIdentificationType(), + ehvdBpkTarget); + + + //TODO: request EHVD and handle errors + + //TODO: parse roles from response + + + return Collections.emptyList(); + + } + + @PostConstruct + private void initialize() { + ehvdBpkTarget = config.getBasicConfiguration( + ConfigurationProperties.PROP_MODULE_SERVICE_TARGET, + ConfigurationProperties.DEFAULT_EHVD_SERVICE_TARGET); + Logger.info("Initialize EHVD Client with bPK target: " + ehvdBpkTarget); + + } + +} |