diff options
Diffstat (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes')
-rw-r--r-- | eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BPKAttributeBuilder.java | 16 |
1 files changed, 12 insertions, 4 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 7005c930..714ffc9d 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 @@ -26,9 +26,12 @@ *******************************************************************************/ 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 org.springframework.util.Assert; import at.gv.egiz.eaaf.core.api.data.EAAFConstants; import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator; @@ -44,18 +47,21 @@ public class BPKAttributeBuilder implements IPVPAttributeBuilder { private static final Logger log = LoggerFactory.getLogger(BPKAttributeBuilder.class); public static final String DELIMITER_BPKTYPE_BPK = ":"; + @Override public String getName() { return BPK_NAME; } + @Override public <ATT> ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator<ATT> g) throws AttributeBuilderException { - String result = getBpkForSP(authData); + final String result = getBpkForSP(authData); log.trace("Authenticate user with bPK/wbPK: " + result); return g.buildStringAttribute(BPK_FRIENDLY_NAME, BPK_NAME, result); } + @Override public <ATT> ATT buildEmpty(IAttributeGenerator<ATT> g) { return g.buildEmptyAttribute(BPK_FRIENDLY_NAME, BPK_NAME); } @@ -68,8 +74,8 @@ public class BPKAttributeBuilder implements IPVPAttributeBuilder { * @throws UnavailableAttributeException */ protected String getBpkForSP(IAuthData authData) throws UnavailableAttributeException { - String bpk = attrMaxSize(authData.getBPK()); - String type = removeBpkTypePrefix(authData.getBPKType()); + final String bpk = attrMaxSize(authData.getBPK()); + final String type = removeBpkTypePrefix(authData.getBPKType()); if (StringUtils.isEmpty(bpk)) throw new UnavailableAttributeException(BPK_NAME); @@ -98,7 +104,9 @@ public class BPKAttributeBuilder implements IPVPAttributeBuilder { * @param type * @return */ - protected String removeBpkTypePrefix(String type) { + @Nonnull + protected String removeBpkTypePrefix(@Nonnull String type) { + Assert.isTrue(type != null, "bPKType is 'NULL'"); if (type.startsWith(EAAFConstants.URN_PREFIX_WBPK)) return type.substring((EAAFConstants.URN_PREFIX_WBPK).length()); |