diff options
Diffstat (limited to 'eaaf_core/src/main/java')
| -rw-r--r-- | eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/BpkBuilder.java | 19 | 
1 files changed, 11 insertions, 8 deletions
| diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/BpkBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/BpkBuilder.java index 7b9ffcf0..81d50d76 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/BpkBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/BpkBuilder.java @@ -28,19 +28,19 @@ import java.util.Date;  import java.util.Map.Entry;  import javax.annotation.Nonnull; -import javax.annotation.Nullable;  import javax.crypto.BadPaddingException;  import javax.crypto.Cipher;  import javax.crypto.IllegalBlockSizeException;  import javax.crypto.NoSuchPaddingException;  import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.Pair; +import org.springframework.lang.Nullable;  import org.springframework.util.Assert;  import org.springframework.util.Base64Utils;  import at.gv.egiz.eaaf.core.api.data.EaafConstants;  import at.gv.egiz.eaaf.core.exceptions.EaafBuilderException; -import at.gv.egiz.eaaf.core.impl.data.Pair;  import lombok.extern.slf4j.Slf4j; @@ -53,9 +53,12 @@ import lombok.extern.slf4j.Slf4j;   */  @Slf4j  public class BpkBuilder { +   +  private static final String ERROR_CODE_33 = "builder.33";    private static final String ERROR_MSG_WRONG_TARGET_FORMAT = "bPK-target format must be full URI"; +      /**     * Calculates an area specific unique person-identifier from a baseID.     * @@ -88,17 +91,17 @@ public class BpkBuilder {    public static Pair<String, String> generateAreaSpecificPersonIdentifier(final String baseID,        final String baseIdType, final String targetIdentifier) throws EaafBuilderException {      if (StringUtils.isEmpty(baseID)) { -      throw new EaafBuilderException("builder.00", new Object[] { "baseID is empty or null" }, +      throw new EaafBuilderException(ERROR_CODE_33, new Object[] { "baseID is empty or null" },            "BaseId is empty or null");      }      if (StringUtils.isEmpty(baseIdType)) { -      throw new EaafBuilderException("builder.00", +      throw new EaafBuilderException(ERROR_CODE_33,            new Object[] { "the type of baseID is empty or null" }, "Type of baseId is empty or null");      }      if (StringUtils.isEmpty(targetIdentifier)) { -      throw new EaafBuilderException("builder.00", +      throw new EaafBuilderException(ERROR_CODE_33,            new Object[] { "SP specific target identifier is empty or null" },            "SP specific target identifier is empty or null");      } @@ -130,7 +133,7 @@ public class BpkBuilder {          return buildEidasIdentifer(baseID, baseIdType, cititzenCountryCode, eidasOutboundCountry);        } else { -        throw new EaafBuilderException("builder.00", +        throw new EaafBuilderException(ERROR_CODE_33,              new Object[] { "Target identifier: " + targetIdentifier + " is NOT allowed or unknown" },              "Target identifier: " + targetIdentifier + " is NOT allowed or unknown");        } @@ -145,7 +148,7 @@ public class BpkBuilder {        } else {          log.warn("Get unique identifier for target: " + baseIdType + " but target: "              + targetIdentifier + " is required!"); -        throw new EaafBuilderException("builder.00", +        throw new EaafBuilderException(ERROR_CODE_33,              new Object[] { "Get unique identifier for target: " + baseIdType + " but target: "                  + targetIdentifier + " is required" },              "Get unique identifier for target: " + baseIdType + " but target: " + targetIdentifier @@ -373,7 +376,7 @@ public class BpkBuilder {        return hashBase64;      } catch (final Exception ex) { -      throw new EaafBuilderException("builder.00", new Object[] { "bPK/wbPK", ex.toString() }, +      throw new EaafBuilderException(ERROR_CODE_33, new Object[] {ex.toString() },            ex.getMessage(), ex);      } | 
