diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2020-07-07 15:27:03 +0200 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2020-07-07 15:27:03 +0200 |
commit | e9fa374738cf1bbc84b36c50bba898892d2c1688 (patch) | |
tree | a9a26d836f94a6e3cded80030aa6a1b411a0aab8 /id/server/idserverlib | |
parent | a056118bbfabb53dc2856ff07d068cd57ddc8be3 (diff) | |
parent | 0e6a03ffbc11d07ee2d00abcd573239a971f89b5 (diff) | |
download | moa-id-spss-e9fa374738cf1bbc84b36c50bba898892d2c1688.tar.gz moa-id-spss-e9fa374738cf1bbc84b36c50bba898892d2c1688.tar.bz2 moa-id-spss-e9fa374738cf1bbc84b36c50bba898892d2c1688.zip |
Merge branch 'development_preview'
Diffstat (limited to 'id/server/idserverlib')
3 files changed, 61 insertions, 37 deletions
diff --git a/id/server/idserverlib/pom.xml b/id/server/idserverlib/pom.xml index 87b9f0952..75a2be499 100644 --- a/id/server/idserverlib/pom.xml +++ b/id/server/idserverlib/pom.xml @@ -4,7 +4,7 @@ <parent>
<groupId>MOA.id</groupId>
<artifactId>moa-id</artifactId>
- <version>4.1.2-SNAPSHOT</version>
+ <version>4.1.2</version>
</parent>
<groupId>MOA.id.server</groupId>
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/builder/attributes/BPKListAttributeBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/builder/attributes/BPKListAttributeBuilder.java index c5a8d88b7..8891dc6ab 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/builder/attributes/BPKListAttributeBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/builder/attributes/BPKListAttributeBuilder.java @@ -1,6 +1,7 @@ package at.gv.egovernment.moa.id.protocols.builder.attributes; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,25 +29,35 @@ public class BPKListAttributeBuilder extends BPKAttributeBuilder implements IPVP public <ATT> ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator<ATT> g) throws AttributeBuilderException { - String result = LIST_ELEMENT_START + getBpkForSP(authData) + LIST_ELEMENT_END; - //add additional bPKs if someone are available - if (authData.getAdditionalbPKs() != null && !authData.getAdditionalbPKs().isEmpty()) { - log.info("Adding additional bPKs into bPK attribute"); - for (Pair<String, String> el : authData.getAdditionalbPKs()) { - result += DELIMITER_BPK_LIST - + LIST_ELEMENT_START - + removeBpkTypePrefix(el.getSecond()) - + DELIMITER_BPKTYPE_BPK - + attrMaxSize(el.getFirst()) - + LIST_ELEMENT_END; + //get PVP attribute directly, if exists + String bpkListAttribute = authData.getGenericData(BPK_LIST_NAME, String.class); + if (StringUtils.isEmpty(bpkListAttribute)) { + String result = LIST_ELEMENT_START + getBpkForSP(authData) + LIST_ELEMENT_END; + + //add additional bPKs if someone are available + if (authData.getAdditionalbPKs() != null && !authData.getAdditionalbPKs().isEmpty()) { + log.info("Adding additional bPKs into bPK attribute"); + for (Pair<String, String> el : authData.getAdditionalbPKs()) { + result += DELIMITER_BPK_LIST + + LIST_ELEMENT_START + + removeBpkTypePrefix(el.getSecond()) + + DELIMITER_BPKTYPE_BPK + + attrMaxSize(el.getFirst()) + + LIST_ELEMENT_END; + } + log.trace("Authenticate user with bPK-List: " + result); } - log.trace("Authenticate user with bPK-List: " + result); - } - log.trace("Authenticate user with bPK/wbPK: " + result); - return g.buildStringAttribute(BPK_LIST_FRIENDLY_NAME, BPK_LIST_NAME, result); + log.trace("Authenticate user with bPK/wbPK: " + result); + return g.buildStringAttribute(BPK_LIST_FRIENDLY_NAME, BPK_LIST_NAME, result); + + } else { + log.trace("Authenticate user with bPK/wbPK: " + bpkListAttribute); + return g.buildStringAttribute(BPK_LIST_FRIENDLY_NAME, BPK_LIST_NAME, bpkListAttribute); + + } } public <ATT> ATT buildEmpty(IAttributeGenerator<ATT> g) { diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/builder/attributes/EncryptedBPKAttributeBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/builder/attributes/EncryptedBPKAttributeBuilder.java index bf7187e51..bd9d5b953 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/builder/attributes/EncryptedBPKAttributeBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/builder/attributes/EncryptedBPKAttributeBuilder.java @@ -22,6 +22,8 @@ *******************************************************************************/ package at.gv.egovernment.moa.id.protocols.builder.attributes; +import org.apache.commons.lang3.StringUtils; + import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator; import at.gv.egiz.eaaf.core.api.idp.IAuthData; import at.gv.egiz.eaaf.core.api.idp.IPVPAttributeBuilder; @@ -45,33 +47,44 @@ public class EncryptedBPKAttributeBuilder implements IPVPAttributeBuilder { public <ATT> ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator<ATT> g) throws AttributeBuilderException { - if (authData instanceof IMOAAuthData) { - if (((IMOAAuthData)authData).getEncbPKList() != null && - ((IMOAAuthData)authData).getEncbPKList().size() > 0) { - Pair<String, String> value = ((IMOAAuthData)authData).getEncbPKList().get(0); - String result = BPKListAttributeBuilder.LIST_ELEMENT_START - + value.getSecond() + DELIMITER_ENCBPK_TARGET + value.getFirst() - + BPKListAttributeBuilder.LIST_ELEMENT_END; - - for (int i=1; i<((IMOAAuthData)authData).getEncbPKList().size(); i++) { - Pair<String, String> el = ((IMOAAuthData)authData).getEncbPKList().get(i); - result += BPKListAttributeBuilder.DELIMITER_BPK_LIST - + BPKListAttributeBuilder.LIST_ELEMENT_START - + el.getSecond() + DELIMITER_ENCBPK_TARGET + el.getFirst() - + BPKListAttributeBuilder.LIST_ELEMENT_END; + String encBpkListAttribute = authData.getGenericData(ENC_BPK_LIST_NAME, String.class); + if (StringUtils.isEmpty(encBpkListAttribute)) { + if (authData instanceof IMOAAuthData) { + if (((IMOAAuthData)authData).getEncbPKList() != null && + ((IMOAAuthData)authData).getEncbPKList().size() > 0) { + Pair<String, String> value = ((IMOAAuthData)authData).getEncbPKList().get(0); + String result = BPKListAttributeBuilder.LIST_ELEMENT_START + + value.getSecond() + DELIMITER_ENCBPK_TARGET + value.getFirst() + + BPKListAttributeBuilder.LIST_ELEMENT_END; + for (int i=1; i<((IMOAAuthData)authData).getEncbPKList().size(); i++) { + Pair<String, String> el = ((IMOAAuthData)authData).getEncbPKList().get(i); + result += BPKListAttributeBuilder.DELIMITER_BPK_LIST + + BPKListAttributeBuilder.LIST_ELEMENT_START + + el.getSecond() + DELIMITER_ENCBPK_TARGET + el.getFirst() + + BPKListAttributeBuilder.LIST_ELEMENT_END; + + } + + return g.buildStringAttribute(ENC_BPK_LIST_FRIENDLY_NAME, ENC_BPK_LIST_NAME, + result); + } - - return g.buildStringAttribute(ENC_BPK_LIST_FRIENDLY_NAME, ENC_BPK_LIST_NAME, - result); - + + } else { + Logger.info(ENC_BPK_LIST_FRIENDLY_NAME + " is only available in MOA-ID context"); + } - } else - Logger.info(ENC_BPK_LIST_FRIENDLY_NAME + " is only available in MOA-ID context"); + } else { + return g.buildStringAttribute(ENC_BPK_LIST_FRIENDLY_NAME, ENC_BPK_LIST_NAME, + encBpkListAttribute); + + } throw new UnavailableAttributeException(ENC_BPK_LIST_NAME); - + + } public <ATT> ATT buildEmpty(IAttributeGenerator<ATT> g) { |