aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv
diff options
context:
space:
mode:
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/protocols/builder/attributes/BPKListAttributeBuilder.java41
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/builder/attributes/EncryptedBPKAttributeBuilder.java55
2 files changed, 60 insertions, 36 deletions
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) {