summaryrefslogtreecommitdiff
path: root/eaaf_core
diff options
context:
space:
mode:
authorThomas <>2023-07-12 10:12:18 +0200
committerThomas <>2023-07-12 10:12:18 +0200
commit663667a6a7df13305674636b169bd7a295472e2e (patch)
treec832ef2bdd5d024f8242004482c74b22f5a617d5 /eaaf_core
parentced5a1b911af0ae62229645ca08a9ecc5225783b (diff)
downloadEAAF-Components-663667a6a7df13305674636b169bd7a295472e2e.tar.gz
EAAF-Components-663667a6a7df13305674636b169bd7a295472e2e.tar.bz2
EAAF-Components-663667a6a7df13305674636b169bd7a295472e2e.zip
feat(core): add static method into PVP bPK attribute-builder to build attribute-values according to specification
Diffstat (limited to 'eaaf_core')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BpkAttributeBuilder.java27
1 files changed, 19 insertions, 8 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BpkAttributeBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BpkAttributeBuilder.java
index 5cbfec01..a9bbebfc 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BpkAttributeBuilder.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BpkAttributeBuilder.java
@@ -19,9 +19,9 @@
package at.gv.egiz.eaaf.core.impl.idp.builder.attributes;
+import javax.annotation.Nonnull;
+
import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;
import at.gv.egiz.eaaf.core.api.idp.IAuthData;
@@ -30,12 +30,12 @@ import at.gv.egiz.eaaf.core.api.idp.ISpConfiguration;
import at.gv.egiz.eaaf.core.exceptions.AttributeBuilderException;
import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException;
import at.gv.egiz.eaaf.core.impl.builder.BpkBuilder;
+import lombok.extern.slf4j.Slf4j;
+@Slf4j
@PvpMetadata
public class BpkAttributeBuilder implements IPvpAttributeBuilder {
- private static final Logger log = LoggerFactory.getLogger(BpkAttributeBuilder.class);
-
@Override
public String getName() {
return BPK_NAME;
@@ -55,16 +55,27 @@ public class BpkAttributeBuilder implements IPvpAttributeBuilder {
return g.buildEmptyAttribute(BPK_FRIENDLY_NAME, BPK_NAME);
}
+ /**
+ * Build a bPK attribute-value according to PVP specification.
+ *
+ * @param bpk bPK
+ * @param bpkType Type of the bPK
+ * @return PVP attribute-value for bPK
+ */
+ public static String buildFromBpkAndType(@Nonnull String bpk, @Nonnull String bpkType) {
+ return BpkBuilder.removeBpkTypePrefix(bpkType) + DELIMITER_BPKTYPE_BPK + bpk;
+
+ }
+
protected String getBpkForSP(final IAuthData authData) throws UnavailableAttributeException {
if (StringUtils.isEmpty(authData.getBpk()) || StringUtils.isEmpty(authData.getBpkType())) {
throw new UnavailableAttributeException(BPK_NAME);
}
- final String bpk = attrMaxSize(authData.getBpk());
- final String type = BpkBuilder.removeBpkTypePrefix(authData.getBpkType());
-
- return type + DELIMITER_BPKTYPE_BPK + bpk;
+ return buildFromBpkAndType(
+ attrMaxSize(authData.getBpk()),
+ BpkBuilder.removeBpkTypePrefix(authData.getBpkType()));
}