diff options
Diffstat (limited to 'eaaf_core_api')
18 files changed, 283 insertions, 159 deletions
| diff --git a/eaaf_core_api/pom.xml b/eaaf_core_api/pom.xml index 62001ab7..448165f4 100644 --- a/eaaf_core_api/pom.xml +++ b/eaaf_core_api/pom.xml @@ -7,7 +7,7 @@    <parent>      <groupId>at.gv.egiz</groupId>      <artifactId>eaaf</artifactId> -    <version>1.1.3-SNAPSHOT</version> +    <version>1.2.1-SNAPSHOT</version>    </parent>    <groupId>at.gv.egiz.eaaf</groupId>    <artifactId>eaaf_core_api</artifactId> @@ -53,11 +53,6 @@        <artifactId>javax.servlet-api</artifactId>        <scope>provided</scope>      </dependency> -    <dependency> -      <groupId>junit</groupId> -      <artifactId>junit</artifactId> -      <scope>test</scope> -    </dependency>    </dependencies>    <build> @@ -68,55 +63,6 @@          <directory>src/main/resources</directory>        </resource>      </resources> - -    <plugins> -      <plugin> -        <groupId>org.apache.maven.plugins</groupId> -        <artifactId>maven-compiler-plugin</artifactId> -        <version>3.7.0</version> -        <configuration> -          <source>1.8</source> -          <target>1.8</target> -        </configuration> -        <executions> -          <execution> -            <goals> -              <goal>compile</goal> -              <goal>testCompile</goal> -            </goals> -          </execution> -        </executions> -      </plugin> -      <plugin> -        <groupId>org.apache.maven.plugins</groupId> -        <artifactId>maven-jar-plugin</artifactId> -        <version>3.1.0</version> -        <executions> -          <execution> -            <goals> -              <goal>test-jar</goal> -            </goals> -          </execution> -        </executions> -      </plugin> - -      <!-- enable co-existence of testng and junit --> -      <plugin> -        <artifactId>maven-surefire-plugin</artifactId> -        <version>${surefire.version}</version> -        <configuration> -          <threadCount>1</threadCount> -        </configuration> -        <dependencies> -          <dependency> -            <groupId>org.apache.maven.surefire</groupId> -            <artifactId>surefire-junit47</artifactId> -            <version>${surefire.version}</version> -          </dependency> -        </dependencies> -      </plugin> - -    </plugins>    </build>  </project> diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/IRequestStorage.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/IRequestStorage.java index 2262e68a..93ce5695 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/IRequestStorage.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/IRequestStorage.java @@ -19,6 +19,8 @@  package at.gv.egiz.eaaf.core.api; +import javax.annotation.Nullable; +  import at.gv.egiz.eaaf.core.exceptions.EaafException;  import at.gv.egiz.eaaf.core.exceptions.PendingReqIdValidationException; @@ -52,7 +54,7 @@ public interface IRequestStorage {     *     * @param pendingReqId Id of the pending request     */ -  void removePendingRequest(String pendingReqId); +  void removePendingRequest(@Nullable String pendingReqId);    /**     * change the pendingRequestId of a pending-request. diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/IStatusMessenger.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/IStatusMessenger.java index bbaf86d3..daf2f6ff 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/IStatusMessenger.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/IStatusMessenger.java @@ -59,11 +59,12 @@ public interface IStatusMessenger {    String getMessageWithoutDefault(String messageId, Object[] parameters);    /** -   * Get external errorCode from from Exception. +   * Get internal errorCode from from Exception.     *     * @param throwable Reason of error     * @return external error code     */ +  @Nonnull    String getResponseErrorCode(Throwable throwable);    /** @@ -72,6 +73,7 @@ public interface IStatusMessenger {     * @param intErrorCode internal error code     * @return external error code     */ +  @Nonnull    String mapInternalErrorToExternalError(String intErrorCode);  } diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/EaafConstants.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/EaafConstants.java index 57375e01..82749b81 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/EaafConstants.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/EaafConstants.java @@ -27,6 +27,22 @@ public class EaafConstants {    public static final String CONTENTTYPE_HTML_UTF8 = "text/html; charset=UTF-8"; +  // common http end-point prefixes +  /** +   * Public end-points without any access restriction. +   */ +  public static final String ENDPOINT_PREFIX_PUBLIC = "/public"; +   +  /** +   * Public end-points with access restriction, like AccessToken, PendingRequestIds, ... +   */ +  public static final String ENDPOINT_PREFIX_SECURED = "/public/secure"; +   +  /** +   * Non public end-points that allow restriction on network level. +   */ +  public static final String ENDPOINT_PREFIX_RESTRICTED = "/restricted"; +          // http request parameters for process management    public static final String PARAM_HTTP_TARGET_PENDINGREQUESTID = "pendingid";    public static final String PARAM_HTTP_ERROR_CODE = "errorid"; @@ -43,36 +59,60 @@ public class EaafConstants {    // Austrian specific prefixes for pseudonyms of users    public static final String URN_PART_BASEID = "baseid";    public static final String URN_PART_CDID = "cdid+"; +  public static final String URN_PART_ECDID = "ecdid+";    public static final String URN_PART_WBPK = "wbpk+"; +  public static final String URN_PART_EWBPK = "ewbpk+";    public static final String URN_PART_EIDAS = "eidasid+";    public static final String URN_PREFIX = "urn:publicid:gv.at";    public static final String URN_PREFIX_WITH_COLON = URN_PREFIX + ":";    public static final String URN_PREFIX_BASEID = URN_PREFIX_WITH_COLON + URN_PART_BASEID;    public static final String URN_PREFIX_CDID = URN_PREFIX_WITH_COLON + URN_PART_CDID; +  public static final String URN_PREFIX_ECDID = URN_PREFIX_WITH_COLON + URN_PART_ECDID;    public static final String URN_PREFIX_BPK = URN_PREFIX_CDID + "bpk";    public static final String URN_PREFIX_WBPK = URN_PREFIX_WITH_COLON  + URN_PART_WBPK; +  public static final String URN_PREFIX_EWBPK = URN_PREFIX_WITH_COLON  + URN_PART_EWBPK;    public static final String URN_PREFIX_EIDAS = URN_PREFIX_WITH_COLON + URN_PART_EIDAS;    public static final String URN_PREFIX_OW_BPK = URN_PREFIX_CDID + "OW"; +  /** +   * encrypted bPK target identifier pattern with {0} as bPK target without prefix and {1} as VKZ/SourceId. +   */ +  public static final String URN_ECDID_TARGET_PATTERN =  URN_PREFIX_ECDID + "{1}+{0}"; + +  /** +   * encrypted wbPK target identifier pattern with {0} as bPK target without prefix and {1} as VKZ/SourceId. +   */ +  public static final String URN_EWBPK_TARGET_PATTERN =  URN_PREFIX_EWBPK + "{1}+{0}"; +    public static final String URN_PREFIX_WBPK_TARGET_WITH_X = EaafConstants.URN_PREFIX_WBPK + "X";    private static final String WBPK_TARGET_FN = "FN";    private static final String WBPK_TARGET_ZVR = "ZVR";    private static final String WBPK_TARGET_ERSB = "ERSB"; -   -  private static final String URN_PREFIX_WBPK_TARGET_XFN_TARGET =  + +  private static final String WBPK_CALC_TARGET_ZVR = "VR"; +  private static final String WBPK_CALC_TARGET_ERSB = "ERJ"; + + +  private static final String URN_PREFIX_WBPK_TARGET_XFN_TARGET =        EaafConstants.URN_PREFIX_WBPK_TARGET_WITH_X + WBPK_TARGET_FN; -  private static final String URN_PREFIX_WBPK_TARGET_XZVR_TARGET =  +  private static final String URN_PREFIX_WBPK_TARGET_XZVR_TARGET =        EaafConstants.URN_PREFIX_WBPK_TARGET_WITH_X + WBPK_TARGET_ZVR; -  private static final String URN_PREFIX_WBPK_TARGET_XERSB_TARGET =  +  private static final String URN_PREFIX_WBPK_TARGET_XERSB_TARGET =        EaafConstants.URN_PREFIX_WBPK_TARGET_WITH_X + WBPK_TARGET_ERSB; -   +    private static final String URN_PREFIX_WBPK_TARGET_FN_TARGET = EaafConstants.URN_PREFIX_WBPK + WBPK_TARGET_FN;    private static final String URN_PREFIX_WBPK_TARGET_ZVR_TARGET = EaafConstants.URN_PREFIX_WBPK + WBPK_TARGET_ZVR;    private static final String URN_PREFIX_WBPK_TARGET_ERSB_TARGET = EaafConstants.URN_PREFIX_WBPK + WBPK_TARGET_ERSB; + +  private static final String URN_PREFIX_WBPK_CALC_TARGET_ZVR_TARGET =  +      EaafConstants.URN_PREFIX_WBPK + WBPK_CALC_TARGET_ZVR; +  private static final String URN_PREFIX_WBPK_CALC_TARGET_ERSB_TARGET =  +      EaafConstants.URN_PREFIX_WBPK + WBPK_CALC_TARGET_ERSB; -  public static final Map<String, String> URN_WBPK_TARGET_X_TO_NONE_MAPPER; +  public static final Map<String, String> URN_WBPK_TARGET_X_TO_NONE_MAPPER; +    static {      final Map<String, String> intMap = new LinkedHashMap<>();      intMap.put(URN_PREFIX_WBPK_TARGET_XFN_TARGET, URN_PREFIX_WBPK_TARGET_FN_TARGET); @@ -81,8 +121,19 @@ public class EaafConstants {      URN_WBPK_TARGET_X_TO_NONE_MAPPER = Collections.unmodifiableMap(intMap);    } + +  public static final Map<String, String> URN_WBPK_TARGET_X_TO_CALC_TARGET_MAPPER; + +  static { +    final Map<String, String> intMap = new LinkedHashMap<>(); +    intMap.put(URN_PREFIX_WBPK_TARGET_XFN_TARGET, URN_PREFIX_WBPK_TARGET_FN_TARGET); +    intMap.put(URN_PREFIX_WBPK_TARGET_XZVR_TARGET, URN_PREFIX_WBPK_CALC_TARGET_ZVR_TARGET); +    intMap.put(URN_PREFIX_WBPK_TARGET_XERSB_TARGET, URN_PREFIX_WBPK_CALC_TARGET_ERSB_TARGET); +    URN_WBPK_TARGET_X_TO_CALC_TARGET_MAPPER = Collections.unmodifiableMap(intMap); + +  } -   +    // Authentication process data_constants    public static final String UNIQUESESSIONIDENTIFIER = "eaaf_uniqueSessionIdentifier";    public static final String AUTH_DATA_CREATED = "eaaf_authdata_created"; diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/ExtendedPvpAttributeDefinitions.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/ExtendedPvpAttributeDefinitions.java index 727c360c..5d7fcc07 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/ExtendedPvpAttributeDefinitions.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/ExtendedPvpAttributeDefinitions.java @@ -19,8 +19,14 @@  package at.gv.egiz.eaaf.core.api.data; +import java.util.NoSuchElementException; +import java.util.stream.Stream; +  public interface ExtendedPvpAttributeDefinitions extends PvpAttributeDefinitions { +  String EIDAS_CONNECTOR_UNIQUEID_NAME = "urn:eidgvat:attributes.eidas.uniqueId"; +  String EIDAS_CONNECTOR_UNIQUEID_FRIENDLY_NAME = "EidasNode-UniqueId"; +      String SP_UNIQUEID_NAME = "urn:eidgvat:attributes.ServiceProviderUniqueId";    String SP_UNIQUEID_FRIENDLY_NAME = "ServiceProvider-UniqueId"; @@ -30,9 +36,62 @@ public interface ExtendedPvpAttributeDefinitions extends PvpAttributeDefinitions    String SP_COUNTRYCODE_NAME = "urn:eidgvat:attributes.ServiceProviderCountryCode";    String SP_COUNTRYCODE_FRIENDLY_NAME = "ServiceProvider-CountryCode"; -  String SP_USESMANDATES_NAME = "urn:eidgvat:attributes.ServiceProviderMandateProfiles"; -  String SP_USESMANDATES_FRIENDLY_NAME = "ServiceProvider-MandateProfiles"; +  String SP_USED_MANDATE_PROFILES_NAME = "urn:eidgvat:attributes.ServiceProviderMandateProfiles"; +  String SP_USED_MANDATE_PROFILES_FRIENDLY_NAME = "ServiceProvider-MandateProfiles"; + +  String SP_USED_MANDATE_TYPE_NAME = "urn:eidgvat:attributes.ServiceProviderMandateType"; +  String SP_USED_MANDATE_TYPE_FRIENDLY_NAME = "ServiceProvider-MandateType"; +   +  enum SpMandateModes { +    NONE("none"),  +    NATURAL("natural"), +    NATURAL_FORCE("forceNatural"), +    LEGAL("legal"),         +    LEGAL_FORCE("forceLegal"), +    BOTH("all"), +    BOTH_FORCE("forceAll"); +         +    private final String mandateMode; + +    SpMandateModes(final String mandateMode) { +      this.mandateMode = mandateMode; +    } +     +    /** +     * Get Service-Provider mandate-mode from String representation. +     * +     * @param s mandate-mode String parameter +     * @return  mandate mode, or {@link NoSuchElementException} if mode is unknown +     */ +    public static SpMandateModes fromString(final String mode) { +      return  Stream.of(SpMandateModes.values()) +          .filter(el -> el.getMode().equals(mode)) +          .findFirst() +          .get(); +       +    } + +    /** +     * Get the URI based status identifier of an E-ID. +     * +     * @return Current mandate mode +     */ +    public String getMode() { +      return this.mandateMode; +    } +     +    @Override +    public String toString() { +      return getMode(); + +    } +     +  } +   +  String EID_BINDING_PUBLIC_KEY_NAME = "urn:eidgvat:attributes.binding.pubkey"; +  String EID_BINDING_PUBLIC_KEY_FRIENDLY_NAME = "Binding-PublicKey"; +      /* Attributes for E-ID */    String EID_ENCRYPTED_SOURCEID_NAME = "urn:eidgvat:attributes.vsz.value";    String EID_ENCRYPTED_SOURCEID_FRIENDLY_NAME = "vSZ"; @@ -43,9 +102,15 @@ public interface ExtendedPvpAttributeDefinitions extends PvpAttributeDefinitions    String EID_EIDBIND_NAME = "urn:eidgvat:attributes.eidbind";    String EID_EIDBIND_FRIENDLY_NAME = "eidBind"; -  String EID_CONSENT_SIGNED_NAME = "urn:eidgvat:attributes.consent.signed"; -  String EID_CONSENT_SIGNED_FRIENDLY_NAME = "userConsent"; +  String EID_AUTHBLOCK_SIGNED_NAME = "urn:eidgvat:attributes.authblock.signed"; +  String EID_AUTHBLOCK_SIGNED_FRIENDLY_NAME = "userAuthBlock"; +  String EID_TRANSACTION_ID_NAME = "urn:eidgvat:attributes.transactionId"; +  String EID_TRANSACTION_ID_FRIENDLY_NAME = "transactionId"; +   +  String EID_PII_TRANSACTION_ID_NAME = "urn:eidgvat:attributes.piiTransactionId"; +  String EID_PII_TRANSACTION_ID_FRIENDLY_NAME = "piiTransactionId"; +      String EID_MIS_MANDATE_NAME = "urn:eidgvat:attributes.mis.mandate";    String EID_MIS_MANDATE_FRIENDLY_NAME = "mandate"; diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/PvpAttributeDefinitions.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/PvpAttributeDefinitions.java index 793715f1..de227ccb 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/PvpAttributeDefinitions.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/data/PvpAttributeDefinitions.java @@ -63,6 +63,7 @@ public interface PvpAttributeDefinitions {    String BPK_FRIENDLY_NAME = "BPK";    int BPK_MAX_LENGTH = 1024;    String BPK_R_PROFILE21_HEADER = "X-PVP-BPK"; +  String DELIMITER_BPKTYPE_BPK = ":";    String BPK_LIST_OID = "1.2.40.0.10.2.1.1.261.28";    String BPK_LIST_NAME = URN_OID_PREFIX + BPK_LIST_OID; @@ -146,13 +147,40 @@ public interface PvpAttributeDefinitions {      /**       * Get the URI based status identifier of an E-ID.       * -     * @return +     * @return status identifier       */      public String getUri() {        return this.uri;      }    } +   +  String EID_IDA_LEVEL_OID = "1.2.40.0.10.2.1.1.261.107"; +  String EID_IDA_LEVEL_NAME = URN_OID_PREFIX + EID_IDA_LEVEL_OID; +  String EID_IDA_LEVEL_FRIENDLY_NAME = "EID-IDA-LEVEL"; + +  enum EidIdaLevelValues { +    BASIC("urn:eidgvat:eid.status.basic"),  +    FULL("urn:eidgvat:eid.status.full"), +    EIDAS("urn:eidgvat:eid.status.eidas"); + +    private final String urn; + +    EidIdaLevelValues(final String urn) { +      this.urn = urn; +    } + +    /** +     * Get the URN based identifier of the ID Austria level. +     * +     * @return level identifier +     */ +    public String getUrn() { +      return this.urn; +    } +  } +   +      String EID_ISSUING_NATION_OID = "1.2.40.0.10.2.1.1.261.32";    String EID_ISSUING_NATION_NAME = URN_OID_PREFIX + EID_ISSUING_NATION_OID;    String EID_ISSUING_NATION_FRIENDLY_NAME = "EID-ISSUING-NATION"; @@ -339,4 +367,6 @@ public interface PvpAttributeDefinitions {    String PVP_HOLDEROFKEY_NAME = URN_OID_PREFIX + PVP_HOLDEROFKEY_OID;    String PVP_HOLDEROFKEY_FRIENDLY_NAME = "HOLDER-OF-KEY-CERTIFICATE"; +   +    } diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/gui/IGuiBuilderConfiguration.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/gui/IGuiBuilderConfiguration.java index 55197b52..28e0278c 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/gui/IGuiBuilderConfiguration.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/gui/IGuiBuilderConfiguration.java @@ -51,4 +51,16 @@ public interface IGuiBuilderConfiguration {     * @return ContentType, or null if default ContentType should be used.     */    String getDefaultContentType(); +   +   +  /** +   * Indicate GUI-Builder to render the GUI asynchronous if it's support by builder implementation. +   *  +   * <p><b>Default:</b> <code>true</code></p> +   *  +   * @return <code>true</code> to indicate that asynchronous rendering is perverted  +   */ +  boolean isWriteAsynch(); +   +    } diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/gui/IGuiFormBuilder.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/gui/IGuiFormBuilder.java index d376d17b..09c4a8b3 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/gui/IGuiFormBuilder.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/gui/IGuiFormBuilder.java @@ -35,10 +35,7 @@ public interface IGuiFormBuilder {    /**     * Parse a GUI template, with parameters into a http servlet-response and use     * the default http-response content-type. <br> -   * <br> -   * The parser use the <code>VelocityEngine</code> as internal template -   * evaluator. -   * +   *      * @param httpReq    http-request object     * @param httpResp   http-response object     * @param config     Configuration object @@ -51,10 +48,7 @@ public interface IGuiFormBuilder {    /**     * Parse a GUI template, with parameters into a http servlet-response. <br> -   * <br> -   * The parser use the <code>VelocityEngine</code> as internal template -   * evaluator. -   * +   *      * @param httpReq     http-request object     * @param httpResp    http-response object     * @param config      Configuration object @@ -66,4 +60,16 @@ public interface IGuiFormBuilder {    void build(HttpServletRequest httpReq, HttpServletResponse httpResp, IGuiBuilderConfiguration config,        String contentType, String loggerName) throws GuiBuildException; +  /** +   * Analyze GUI template and HTTP request to evaluate ContentType of HTTP response generated by this builder. +   *  +   * @param httpReq    http-request object +   * @param config     Configuration object +   * @param loggerName String, which should be used from logger +   * @return ContentType of HTTP response +   * @throws GuiBuildException in case of an error +   */ +  String evaluateResponseContentType(HttpServletRequest httpReq, IGuiBuilderConfiguration config,  +      String loggerName) throws GuiBuildException; +    } diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/IAuthData.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/IAuthData.java index 62aa8852..f76e8d76 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/IAuthData.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/IAuthData.java @@ -30,7 +30,7 @@ import at.gv.egiz.eaaf.core.api.idp.auth.data.IIdentityLink;   *   */  public interface IAuthData { - +      /**     * BaseId transfer policy.     * @@ -75,19 +75,24 @@ public interface IAuthData {    String getGivenName();    /** -   * Date of birth of the user. +   * Date of birth of the user as "yyyy-MM-dd". +   *  +   * <p><b>Attention:</b> <i>MM</i> and <i>dd</i> can also be <i>00</i> in case of an unknown date </p>     *     * @return date of birth or null no data of birth is available     */ -  Date getDateOfBirth(); - +  String getDateOfBirth(); +      /** -   * String formated date of birth of the user with pattern yyyy-MM-dd. -   * -   * -   * @return date of birth or '2999-12-31' if no data of birth is available +   * Get date of birth with a specific date pattern. +   *  +   *  <p><b>Attention:</b> If birthday has un unusal form like <i>MM</i> and <i>dd</i> are <i>00</i>  +   *  a transformation CAN NOT be possible </p> +   *  +   * @param pattern Date pattern, like "yyyy-MM-dd" e.g.  +   * @return Formatted birthday or <code>null</code> if date can not be transformed     */ -  String getFormatedDateOfBirth(); +  String getDateOfBirthFormated(String pattern);    /**     * Get the encrypted SourceId (vSZ) from new E-ID scheme. diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/ISpConfiguration.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/ISpConfiguration.java index 5a16f655..dd4041fc 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/ISpConfiguration.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/ISpConfiguration.java @@ -22,6 +22,7 @@ package at.gv.egiz.eaaf.core.api.idp;  import java.io.Serializable;  import java.util.List;  import java.util.Map; +import java.util.Set;  public interface ISpConfiguration extends Serializable { @@ -121,7 +122,7 @@ public interface ISpConfiguration extends Serializable {     *     * @return     */ -  List<String> getTargetsWithNoBaseIdInternalProcessingRestriction(); +  Set<String> getTargetsWithNoBaseIdInternalProcessingRestriction();    /**     * Get the {@link List} of identifier's that indicates no baseID transfer @@ -131,7 +132,7 @@ public interface ISpConfiguration extends Serializable {     *     * @return     */ -  List<String> getTargetsWithNoBaseIdTransferRestriction(); +  Set<String> getTargetsWithNoBaseIdTransferRestriction();    /**     * Get the List eIDAS LoA that are required by this service provider. diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/IAuthenticationManager.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/IAuthenticationManager.java index 3dba4e78..c72c5b6f 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/IAuthenticationManager.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/IAuthenticationManager.java @@ -23,7 +23,6 @@ import javax.servlet.http.HttpServletRequest;  import javax.servlet.http.HttpServletResponse;  import at.gv.egiz.eaaf.core.api.IRequest; -import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;  import at.gv.egiz.eaaf.core.api.idp.slo.ISloInformationContainer;  import at.gv.egiz.eaaf.core.exceptions.EaafException; @@ -35,22 +34,6 @@ public interface IAuthenticationManager {    int EVENT_AUTHENTICATION_PROCESS_ERROR = 4002;    /** -   * Add a request parameter to whitelist. All parameters that are part of the -   * white list are added into {@link ExecutionContext} -   * -   * @param httpReqParam http parameter name, but never null -   */ -  void addParameterNameToWhiteList(String httpReqParam); - -  /** -   * Add a request header to whitelist. All parameters that are part of the white -   * list are added into {@link ExecutionContext} -   * -   * @param httpReqParam http header name, but never null -   */ -  void addHeaderNameToWhiteList(String httpReqParam); - -  /**     * Starts an authentication process for a specific pending request.     *     * @param httpReq    http servlet request diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/data/IAuthProcessDataContainer.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/data/IAuthProcessDataContainer.java index 274f3f7f..cb9adbc8 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/data/IAuthProcessDataContainer.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/data/IAuthProcessDataContainer.java @@ -21,6 +21,8 @@ package at.gv.egiz.eaaf.core.api.idp.auth.data;  import java.util.Date;  import java.util.Map; +import java.util.Map.Entry; +import java.util.stream.Stream;  import at.gv.egiz.eaaf.core.exceptions.EaafStorageException; @@ -167,8 +169,21 @@ public interface IAuthProcessDataContainer {     */    Date getSessionCreated(); +  /** +   * Get all generic data from session. +   *  +   * @return {@link Map} of generic data in key/value format +   */    Map<String, Object> getGenericSessionDataStorage(); +   +  /** +   * Get all generic data from session as {@link Stream} of {@link Entry} elements. +   *  +   * @return {@link Stream} of generic data +   */ +  Stream<Entry<String, Object>> getGenericSessionDataStream(); +      /**     * Returns a generic session-data object with is stored with a specific     * identifier. diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/data/IEidAuthProcessData.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/data/IEidAuthProcessData.java new file mode 100644 index 00000000..36298824 --- /dev/null +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/data/IEidAuthProcessData.java @@ -0,0 +1,25 @@ +package at.gv.egiz.eaaf.core.api.idp.auth.data; + +/** + * Authentication session-data that adds ID Austria specific information.   + *  + * @author tlenz + * + */ +public interface IEidAuthProcessData extends IAuthProcessDataContainer { + +  /** +   * Flag that indicates if user is a test-identity. +   *  +   * @return <code>true</code> if user is a test-identity, otherwise <code>false</code> +   */ +  boolean isTestIdentity(); + +   +  /** +   * Set test-identity flag for this user. +   *  +   * @param flag <code>true</code> if user is a test-identity +   */ +  void setTestIdentity(boolean flag); +} diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/data/IIdentityLink.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/data/IIdentityLink.java index 74c82181..a2288a5b 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/data/IIdentityLink.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/data/IIdentityLink.java @@ -21,6 +21,7 @@ package at.gv.egiz.eaaf.core.api.idp.auth.data;  import java.io.IOException;  import java.security.PublicKey; +import java.util.Date;  import javax.xml.transform.TransformerException; @@ -28,7 +29,7 @@ import org.w3c.dom.Element;  /**   * Deprecated IdentityLink interface. - *  + *   * @author tlenz   *   */ @@ -188,6 +189,13 @@ public interface IIdentityLink {    String getIssueInstant();    /** +   * Returns the issuing time of the identity link SAML assertion. +   * +   * @return The issuing time of the identity link SAML assertion. +   */ +  Date getIssueInstantDate(); + +  /**     * Sets the issuing time of the identity link SAML assertion.     *     * @param issueInstant The issueInstant to set. diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/services/IProtocolAuthenticationService.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/services/IProtocolAuthenticationService.java index d1d68c2d..8def4e32 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/services/IProtocolAuthenticationService.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/api/idp/auth/services/IProtocolAuthenticationService.java @@ -21,6 +21,7 @@ package at.gv.egiz.eaaf.core.api.idp.auth.services;  import java.io.IOException; +import javax.annotation.Nonnull;  import javax.servlet.http.HttpServletRequest;  import javax.servlet.http.HttpServletResponse; @@ -34,8 +35,12 @@ public interface IProtocolAuthenticationService {    String PARAM_GUI_ERROMSG = "errorMsg";    String PARAM_GUI_ERRORCODE = "errorCode"; +  String PARAM_GUI_EXTERNAL_ERRORCODE = "extErrorCode";    String PARAM_GUI_ERRORCODEPARAMS = "errorParams";    String PARAM_GUI_ERRORSTACKTRACE = "stacktrace"; +  String PARAM_GUI_TICKET = "supportTicket"; +  String PARAM_GUI_REDIRECT = "redirectLink"; +    /**     * Initialize an authentication process for this protocol request. @@ -46,8 +51,8 @@ public interface IProtocolAuthenticationService {     * @throws IOException   In case of a communication error     * @throws EaafException In case of an application error     */ -  void performAuthentication(HttpServletRequest httpReq, HttpServletResponse httpResp, IRequest pendingReq) -      throws IOException, EaafException; +  void performAuthentication(@Nonnull HttpServletRequest httpReq, @Nonnull HttpServletResponse httpResp,  +      @Nonnull IRequest pendingReq) throws IOException, EaafException;    /**     * Finalize the requested protocol operation. @@ -59,8 +64,8 @@ public interface IProtocolAuthenticationService {     *                       {@link HttpServletResponse}     * @throws EaafException If an internal error occur     */ -  void finalizeAuthentication(HttpServletRequest httpReq, HttpServletResponse httpResp, IRequest pendingReq) -      throws EaafException, IOException; +  void finalizeAuthentication(@Nonnull HttpServletRequest httpReq, @Nonnull HttpServletResponse httpResp,  +      @Nonnull IRequest pendingReq) throws EaafException, IOException;    /**     * Build protocol-specific error message. @@ -73,8 +78,8 @@ public interface IProtocolAuthenticationService {     *                       {@link HttpServletResponse}     * @throws EaafException If an internal error occur     */ -  void buildProtocolSpecificErrorResponse(Throwable throwable, HttpServletRequest req, HttpServletResponse resp, -      IRequest pendingReq) throws IOException, EaafException; +  void buildProtocolSpecificErrorResponse(@Nonnull Throwable throwable, @Nonnull HttpServletRequest req,  +      @Nonnull HttpServletResponse resp, @Nonnull IRequest pendingReq) throws IOException, EaafException;    /**     * Handles all exceptions with no pending request. Therefore, the error is @@ -91,21 +96,21 @@ public interface IProtocolAuthenticationService {     *                       {@link HttpServletResponse}     * @throws EaafException If an internal error occure     */ -  void handleErrorNoRedirect(Throwable throwable, HttpServletRequest req, HttpServletResponse resp, -      boolean writeExceptionToStatisticLog) throws IOException, EaafException; +  void handleErrorNoRedirect(@Nonnull Throwable throwable, @Nonnull HttpServletRequest req,  +      @Nonnull HttpServletResponse resp, boolean writeExceptionToStatisticLog) throws IOException, EaafException;    /**     * Forward the process to error-handler in case of an error. -   *  +   *     * @param errorToHandle Error to handle     * @param errorKey ErrorId for error-handler     * @param req HTTP response     * @param resp HTTP response     * @throws GuiBuildException In case of an GUI generation error     */ -  void forwardToErrorHandler(Pair<IRequest, Throwable> errorToHandle, String errorKey,  -      HttpServletRequest req, HttpServletResponse resp) throws GuiBuildException; -   -   -   +  void forwardToErrorHandler(@Nonnull Pair<IRequest, Throwable> errorToHandle, @Nonnull String errorKey, +      @Nonnull HttpServletRequest req, @Nonnull HttpServletResponse resp) throws GuiBuildException; + + +  } diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/EaafException.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/EaafException.java index 351c6bbe..e1719abc 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/EaafException.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/EaafException.java @@ -27,8 +27,7 @@ import at.gv.egiz.eaaf.core.impl.logging.LogMessageProviderFactory;  public class EaafException extends Exception { -  private static final long serialVersionUID = 1L; - +  private static final long serialVersionUID = -4527097018108560426L;    private String errorId = null;    private Object[] params = null; diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/PendingReqIdValidationException.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/PendingReqIdValidationException.java index ddc051b0..e7c968b5 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/PendingReqIdValidationException.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/PendingReqIdValidationException.java @@ -15,10 +15,10 @@ public class PendingReqIdValidationException extends EaafException {     * Pending-Request Id validation error.     *     * @param internalPendingReqId Internal Pending-Request Id -   * @param reason               error-message +   * @param errorId               Detailed Id of the error     */ -  public PendingReqIdValidationException(final String internalPendingReqId, @Nonnull final String reason) { -    super("process.99", new Object[] { internalPendingReqId, reason }); +  public PendingReqIdValidationException(final String internalPendingReqId, @Nonnull final String errorId) { +    super(errorId, new Object[] { internalPendingReqId});      this.invalidInternalPendingReqId = internalPendingReqId;    } @@ -27,12 +27,12 @@ public class PendingReqIdValidationException extends EaafException {     * Pending-Request Id validation error.     *     * @param internalPendingReqId Internal Pending-Request Id -   * @param reason               error-message +   * @param errorId              Detailed Id of the error     * @param e                    error     */ -  public PendingReqIdValidationException(final String internalPendingReqId, @Nonnull final String reason, +  public PendingReqIdValidationException(final String internalPendingReqId, @Nonnull final String errorId,        final Throwable e) { -    super("process.99", new Object[] { internalPendingReqId, reason }, e); +    super(errorId, new Object[] { internalPendingReqId, errorId }, e);      this.invalidInternalPendingReqId = internalPendingReqId;    } diff --git a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/XPathException.java b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/XPathException.java index b20efe3d..3343a089 100644 --- a/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/XPathException.java +++ b/eaaf_core_api/src/main/java/at/gv/egiz/eaaf/core/exceptions/XPathException.java @@ -19,9 +19,6 @@  package at.gv.egiz.eaaf.core.exceptions; -import java.io.PrintStream; -import java.io.PrintWriter; -  /**   * An exception occurred evaluating an XPath.   * @@ -56,32 +53,4 @@ public class XPathException extends RuntimeException {      return wrapped;    } -  /** -   * Print error message. -   * -   * @see java.lang.Throwable#printStackTrace(java.io.PrintStream) -   */ -  @Override -  public void printStackTrace(final PrintStream s) { -    super.printStackTrace(s); -    if (getWrapped() != null) { -      s.print("Caused by: "); -      getWrapped().printStackTrace(s); -    } -  } - -  /** -   * Print error message. -   * -   * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter) -   */ -  @Override -  public void printStackTrace(final PrintWriter s) { -    super.printStackTrace(s); -    if (getWrapped() != null) { -      s.print("Caused by: "); -      getWrapped().printStackTrace(s); -    } -  } -  } | 
