summaryrefslogtreecommitdiff
path: root/eaaf_core/src
diff options
context:
space:
mode:
Diffstat (limited to 'eaaf_core/src')
-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()));
}