From 456513332389b2dbb7a6d1461f77dda9b7393050 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 14 Aug 2015 13:53:00 +0200 Subject: use old ConfigTool --- .../htmlTemplates/loginFormFull.html | 101 ++- .../moa-id-configtool.properties | 15 +- .../moa-id-configuration/userdatabase.properties | 14 - .../conf/moa-id/htmlTemplates/loginFormFull.html | 117 +++- id/server/data/deploy/conf/moa-id/log4j.properties | 1 + id/server/doc/handbook/config/config.html | 193 +++--- id/server/doc/handbook/install/install.html | 27 +- id/server/doc/htmlTemplates/BKU-selection.html | 101 ++- id/server/idserverlib/pom.xml | 6 + .../moa/id/config/ConfigurationProviderImpl.java | 2 +- .../moa/id/entrypoints/DispatcherServlet.java | 1 + .../resources/templates/loginFormFull.html | 103 ++- id/server/moa-id-commons/pom.xml | 4 +- .../config/ConfigurationMigrationUtils.java | 198 +++--- .../moa/id/commons/config/ConfigurationUtil.java | 2 +- .../config/MOAIDConfigurationConstants.java | 3 + .../moa/id/commons/config/cli/MOAIDConfCLI.java | 2 +- .../config/persistence/MOAIDConfiguration.java | 9 + .../config/persistence/MOAIDConfigurationImpl.java | 15 +- .../moa/id/commons/db/NewConfigurationDBRead.java | 751 +++++++++------------ .../moa/id/commons/db/NewConfigurationDBWrite.java | 119 +--- .../dao/config/deprecated/MOAIDConfiguration.java | 18 + .../dao/config/deprecated/OnlineApplication.java | 32 + .../id/commons/validation/ValidationHelper.java | 2 +- .../src/main/resources/META-INF/persistence.xml | 1 + 25 files changed, 983 insertions(+), 854 deletions(-) (limited to 'id/server') diff --git a/id/server/data/deploy/conf/moa-id-configuration/htmlTemplates/loginFormFull.html b/id/server/data/deploy/conf/moa-id-configuration/htmlTemplates/loginFormFull.html index d0af6401b..123a23837 100644 --- a/id/server/data/deploy/conf/moa-id-configuration/htmlTemplates/loginFormFull.html +++ b/id/server/data/deploy/conf/moa-id-configuration/htmlTemplates/loginFormFull.html @@ -15,13 +15,17 @@ text-align: center; background-color: #6B7B8B; } + + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU p { font-size: 0.7em; } #localBKU input{ - font-size: 0.7em; + font-size: 0.85em; /*border-radius: 5px;*/ } @@ -142,6 +146,8 @@ margin-bottom: 10px; } + + #validation { position: absolute; bottom: 0px; @@ -154,7 +160,10 @@ @media screen and (max-width: 205px) { #localBKU p { font-size: 0.6em; - } + } + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.6em; @@ -191,6 +200,9 @@ #localBKU p { font-size: 0.7em; } + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.7em; @@ -227,6 +239,9 @@ #localBKU p { font-size: 0.9em; } + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.8em; @@ -257,7 +272,9 @@ #localBKU p { font-size: 0.9em; } - + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.8em; min-width: 70px; @@ -288,7 +305,9 @@ #localBKU p { font-size: 0.9em; } - + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.8em; min-width: 70px; @@ -327,7 +346,9 @@ font-size: 100%; background-color: #MAIN_BACKGOUNDCOLOR#; } - + .browserInfoButton{ + color: rgb(128, 128, 128); + } #page { visibility: hidden; margin-top: 0%; @@ -464,12 +485,11 @@ } #localBKU { - padding-left: 5%; - padding-right: 2%; padding-bottom: 4%; /*padding-top: 4%;*/ position: relative; - clear: both; + clear: both; + text-align: center; } #bkukarte { @@ -526,13 +546,13 @@ #localBKU input { /* color: #BUTTON_COLOR#; */ - border: 0px; + /*border: 0px;*/ display: inline-block; } #localBKU input:hover, #localBKU input:focus, #localBKU input:active { - text-decoration: underline; + /*text-decoration: underline;*/ } #installJava, #BrowserNOK { @@ -727,6 +747,56 @@ } } + + function checkIfBrowserSupportsJava(){ + console.log("Browser is Chrome: "+checkIfBrowserIsChrome()); + console.log("Browser is Safari: "+checkIfBrowserIsSafari()); + console.log("Browser is Edge: "+checkIfBrowserIsEdge()); + + var cnt = 0; + + if(checkIfBrowserIsChrome())cnt++; + if(checkIfBrowserIsEdge())cnt++; + if(checkIfBrowserIsSafari())cnt++; + + if(cnt==0 || cnt>1)//cnt>1 means perhaps wrong detection + return true; + + var image = document.getElementById("bkuimage"); + var srcatt = image.getAttribute("src"); + var last = srcatt.substring(srcatt.lastIndexOf('/')+1); + srcatt = srcatt.replace(last,'online-bku-deactivated.png'); + image.setAttribute("src",srcatt); + + + var button = document.getElementsByName("bkuButtonOnline")[0]; + button.setAttribute("class","browserInfoButton"); + button.setAttribute("title","Java wird nicht unterstützt, klicken für mehr Informationen."); + button.setAttribute("onClick","alert('Java wird von Ihrem Browser nicht unterstützt, ist jedoch für den Betrieb der Online Bürgerkartenumgebung notwendig.\\nWollen Sie dennoch die Online Bürgerkartenumgebung verwenden, wird zur Zeit Java noch von Firefox und MS Internet Explorer unterstützt. \\nAlternativ koennen Sie auch eine lokale Bürgerkartenumgebung verwenden, verfügbar unter www.buergerkarte.at.');"); + + return false; + + } + function checkIfBrowserIsChrome(){ + var chrome_defined = !!window.chrome;//chrome object defined + var webstore_defined = false; + if(window.chrome){ + webstore_defined = !!window.chrome.webstore; + } + return chrome_defined && webstore_defined; + } + function checkIfBrowserIsEdge(){//edge also defines the chrome object, but not the webapp + var chrome_defined = !!window.chrome;//chrome object defined + var webstore_defined = true; + if(window.chrome){ + webstore_defined = !!window.chrome.webstore; + } + return chrome_defined && !webstore_defined; + } + function checkIfBrowserIsSafari(){ + var cond1 = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; + return cond1; + } /* function setSSOSelection() { document.getElementById("useSSO").value = "false"; var checkbox = document.getElementById("SSOCheckBox"); @@ -754,7 +824,7 @@ Anmeldung mittels Bürgerkarte oder Handy-Signatur - +

Anmeldung an: #OAName#

@@ -779,7 +849,7 @@
- OnlineBKU @@ -801,9 +871,8 @@ name="MODUL" value="#MODUL#"> - +

3.2 Online Applikationen

Die Konfiguration von Online-Applikationen erfolgt ebenfalls mit Hilfe des Moduls MOA-ID-Configuration. Es können sowohl neue Online-Applikationen erstellt als auch bestehende Online-Applikationen bearbeitet oder gelöscht werden. Der erlaubte Konfigurationsumfang hängt jedoch von Role des aktuellen Benutzers ab, wobei eine Konfiguration der gesamten Parameter nur einem Benutzer mit der Role admin möglich ist. Alle Konfigurationsfelder die nur einem Benutzer mit der Role admin zur Verfügung stehen sind gesondert gekennzeichnet.

3.2.1 Informationen zur Online-Applikation (Service Provider)

@@ -1845,20 +1841,13 @@ Soll die Bürgerkartenauswahl weiterhin, wie in MOA-ID 1.5.1 im Kontext der Optional Beschreibung - - Neu Laden -   -   - X - Wird diese Option gewählt erfolgt nach dem Speicher der Konfiguration eine Neuinitialisierung der PVP 2.1 Metadaten der Online-Applikation durch die MOA-ID-Auth Instanz. - URL zu den Metadaten http://demo.egiz.gv.at/demologin-pvp2-sso/metadata/demoportal-pvp2-sso.mdxml     URL unter der die MOA-ID-Auth Instanz die Metadaten der Online-Applikation beziehen kann. Diese Metadaten müssen durch die Online-Applikation signiert sein. Für den Fall das die Metadaten über https abgeholt werden, muss das jeweilige Serverzertifikat zur Zertifikatsprüfung im TrustStore der MOA-ID-Auth Instanz hinterlegt sein. Die Metadaten werden anschließend durch MOA-ID-Auth innerhalb des in den Metadaten angegebenen Gültigkeitszeitraums automatisch aktualisiert. Das Aktualisierungsintervall bei automatischer Aktualisierung beträgt jedoch mindestens 15 Minuten jedoch nicht mehr als 24 Stunden. (Intervall: 15min < Aktualisierungszeitpunkt < 24 Stunden) -

Hinweis: Metadaten k\F6nnen nur \FCber http oder https bezogen werden. Das Laden von Metadaten aus dem lokalen Verzeichnissystem ist nicht m\F6glich.

+

Hinweis: Metadaten können nur über http oder https bezogen werden. Das Laden von Metadaten aus dem lokalen Verzeichnissystem ist nicht möglich.

Infos zum Zertifikat @@ -1909,8 +1898,8 @@ Soll die Bürgerkartenauswahl weiterhin, wie in MOA-ID 1.5.1 im Kontext der
3.2.8 Zusätzliche allgemeine Einstellungen
-

In Abschnitt erm\F6glicht eine erweiterte online-applikationsspezifische Individualisierung des AuthBlocks und der B\FCrgerkartenauswahl. - Die Individualisierung des AuthBlocks steht jedoch dann zur Verf\FCgung wenn die dem Module MOA-ID-Auth beigelegte Security-Layer Transformation verwendet wird oder +

In Abschnitt ermöglicht eine erweiterte online-applikationsspezifische Individualisierung des AuthBlocks und der Bürgerkartenauswahl. + Die Individualisierung des AuthBlocks steht jedoch dann zur Verfügung wenn die dem Module MOA-ID-Auth beigelegte Security-Layer Transformation verwendet wird oder wenn die individuelle Security-Layer Transformation den Formvorschriften der Spezifikation entspricht.

@@ -1940,13 +1929,13 @@ wenn die individuelle Security-Layer Transformation den Formvorschriften der Sp - +
    XWird diese Option gew\E4hlt wird im AuthBlock, welcher im Anmeldevorgang signiert wird, keine bPK oder wbPK dargestellt.Wird diese Option gewählt wird im AuthBlock, welcher im Anmeldevorgang signiert wird, keine bPK oder wbPK dargestellt.
3.2.8.1 Login-Fenster Konfiguration
-

Diese Konfigurationsparameter bieten zus\E4tzliche Einstellungen f\FCr eine Anpassung der B\FCrgerkartenauswahl welche von MOA-ID-Auth generiert wird. +

Diese Konfigurationsparameter bieten zusätzliche Einstellungen für eine Anpassung der Bürgerkartenauswahl welche von MOA-ID-Auth generiert wird. Zur besseren Handhabung werden die angegebenen Parameter direkt in einer Vorschau dargestellt. -Alle in diesem Abschnitt angegebenen Parameter sind Optional und werden bei Bedarf durch Standardwerte erg\E4nzt. +Alle in diesem Abschnitt angegebenen Parameter sind Optional und werden bei Bedarf durch Standardwerte ergänzt.

@@ -1961,50 +1950,50 @@ Alle in diesem Abschnitt angegebenen Parameter sind Optional und werden bei Beda - + - + - + - + - + - + - + - + - - + - + @@ -2018,58 +2007,50 @@ Alle in diesem Abschnitt angegebenen Parameter sind Optional und werden bei Beda - + - +
#E5E5E5 X XHintergrundfarbe der B\FCrgerkartenauswahl und Hintergrundfarbe des Java-Applets der Online-BKU (wird über den Security-Layer Request angegeben). Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.Hintergrundfarbe der Bürgerkartenauswahl und Hintergrundfarbe des Java-Applets der Online-BKU (wird über den Security-Layer Request angegeben). Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.
Vordergrundfarbe #E5E5E5 X  Vordergrundfarbe (Textfarbe) der B\FCrgerkartenauswahl. Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.Vordergrundfarbe (Textfarbe) der Bürgerkartenauswahl. Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.
Hintergrundfarbe \DCberschriftHintergrundfarbe Überschrift #E5E5E5 X  Hintergrundfarbe der \DCberschrift der B\FCrgerkartenauswahl. Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.Hintergrundfarbe der Überschrift der Bürgerkartenauswahl. Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.
Vordergrundfarbe \DCberschriftVordergrundfarbe Überschrift #E5E5E5 X  Vordergrundfarbe (Textfarbe) der \DCberschrift der B\FCrgerkartenauswahl. Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.Vordergrundfarbe (Textfarbe) der Überschrift der Bürgerkartenauswahl. Die Angabe der Farbe erfolgt als RGB Wert in hexadezimaler Form.
\DCberschriftstextÜberschriftstext Anmeldung X  Die hier angegebene Zeichenkette wird als \DCberschrift in der B\FCrgerkartenauswahl dargestellt. Es sind jedoch nur Buchstaben, Zahlen und Satzzeichen erlaubt.Die hier angegebene Zeichenkette wird als Überschrift in der Bürgerkartenauswahl dargestellt. Es sind jedoch nur Buchstaben, Zahlen und Satzzeichen erlaubt.
Targetparameter     XMit diesem Parameter kann der Redirect-Target welcher im Security-Layer Request an die BKU \FCbergeben wird definiert werden. Die m\F6glichen Parameter sind \E4quivalent zum + Mit diesem Parameter kann der Redirect-Target welcher im Security-Layer Request an die BKU übergeben wird definiert werden. Die möglichen Parameter sind äquivalent zum html Attribut target (siehe Kapitel 4.3).
Appleth\F6heApplethöhe 220   XMit diesem Parameter kann die H\F6he des Java-Applets der Online-BKU definiert werden. Dieser Parameter überschreibt einen in der BKU-Auswahl übergebenen Parameter (siehe Kapitel 3.4.1).Mit diesem Parameter kann die Höhe des Java-Applets der Online-BKU definiert werden. Dieser Parameter überschreibt einen in der BKU-Auswahl übergebenen Parameter (siehe Kapitel 3.4.1).
Appletbreite  X  Dieses Feld erlaubt die Auswahl der gew\FCnschten Schriftart, welche f\FCr die BKU-Auswahl verwendet werden soll. Es kann jedoch nur eine Schriftart gew\E4hlt werden.Dieses Feld erlaubt die Auswahl der gewünschten Schriftart, welche für die BKU-Auswahl verwendet werden soll. Es kann jedoch nur eine Schriftart gewählt werden.
Formularschrifttyp (Textfeld)   X  Dieses Textfeld erlaubt die Konfiguration eine Liste von Schriftarten, welche f\FCr die BKU-Auswahl verwendet werden soll. - Die Angabe erfolgt mittels einer durch "," getrennten Liste, \E4quivalent zur Schriftartendefinition laut HTML SpezifikationDieses Textfeld erlaubt die Konfiguration eine Liste von Schriftarten, welche für die BKU-Auswahl verwendet werden soll. + Die Angabe erfolgt mittels einer durch "," getrennten Liste, äquivalent zur Schriftartendefinition laut HTML Spezifikation

 

-

Hinweis: Bei Verwendung einer online-applikationsspezifischen B\FCrgerkartenauswahl stehen alle Parameter die die B\FCrgerkartenauswahl betreffen nicht zur Verf\FCgung.

-

Hinweis: Bei Verwendung eines online-applikationsspezifischen Security-Layer-Request Templates stehen alle Parameter die das SL-Template betreffen nicht zur Verf\FCgung.

+

Hinweis: Bei Verwendung einer online-applikationsspezifischen Bürgerkartenauswahl stehen alle Parameter die die Bürgerkartenauswahl betreffen nicht zur Verfügung.

+

Hinweis: Bei Verwendung eines online-applikationsspezifischen Security-Layer-Request Templates stehen alle Parameter die das SL-Template betreffen nicht zur Verfügung.

+
3.2.9 Revisionslogging
+

Ab MOA-ID 3.x steht ein erweitertes speziell für Revisionsaufgaben abgestimmtest Logging zur Verfügung. Über dieses Feld können die zu loggenden Events als CSV codierte Eventcodes konfiguriert werden. Werden keine Eventcodes konfiguriert wird eine in MOA-ID hinterlegte Defaultkonfiguration verwendet. Eine Liste aller möglichen Eventcodes finden Sie hier.

3.3 Import / Export

-

\DCber diese Funktionalit\E4t besteht die M\F6glichkeit eine bestehende MOA-ID 1.5.1 -Konfiguration in MOA-ID 2.0 zu importieren. Zus\E4tzlich besteht die M\F6glichkeit eine MOA-ID-Auth 2.0 -Konfiguration in ein XML Dokument zu exportieren oder in eine bestehende MOA-ID-Auth 2.0 -XML Konfiguration zu importieren. Eine exportierte MOA-ID-Auth 2.0 XML-Konfiguration kann auch direkt zur Konfiguration des Modules MOA-ID-Auth herangezogen werden (siehe Kapitel 2.2.2.1)

+

Üer diese Funktionalität besteht die Möglichkeit eine bestehende MOA-ID 2.x.x +Konfiguration in MOA-ID 3.x zu importieren. Zusätzlich besteht die Möglichkeit eine MOA-ID-Auth 3.0 +Konfiguration in ein Dokument zu exportieren oder in eine bestehende MOA-ID-Auth 3.0 + Konfiguration zu importieren.

Hinweis: Zu beachten ist, dass bei einem Import die aktuell vorhandene - Konfiguration vollst\E4ndig gel\F6scht und durch die importierte Konfiguration ersetzt wird. - Es wird empfohlen ein Backup einer eventuell vorhandenen MOA-ID 2.0 Konfiguration - zu erstellen, bevor eine neue Konfiguration importiert wird. Hierf\FCr kann die + Konfiguration vollständig gelöscht und durch die importierte Konfiguration ersetzt wird. + Es wird empfohlen ein Backup einer eventuell vorhandenen MOA-ID 3.0 Konfiguration + zu erstellen, bevor eine neue Konfiguration importiert wird. Hierfür kann die Exportfunktion verwendet werden.

-

3.3.1 Import alter Konfigurationen (<= MOA-ID 1.5.1)

-

Es besteht auch die Möglichkeit eine bestehende MOA-ID 1.5.1 Konfiguration zu importieren. Da nicht alle neuen Konfigurationsparameter automatisiert aus der MOA-ID 1.5.1 Konfiguration erstellt werden sind für den Importvorgang mehrere Schritte notwendig.

+

3.3.1 Import alter Konfigurationen ( MOA-ID 2.x.x)

+

Es besteht auch die Möglichkeit eine bestehende MOA-ID 2.x.x Konfiguration zu importieren. Hierfür muss zuerst die bestehende MOA-ID 2.x.x Konfiguration mit Hilfe des in MOA-ID 2.x.x verwendeten Konfigurationstools in eine Datei exportiert werden. Anschließend kann die expotierte Datei in das neue Format konfertiert und wieder in die Konfigurationsdatenbank importiert werden. Die einzelnen Schritte werden in der nachfolgenden Aufzählung näher beschrieben.

    -
  1. Importieren einer bestehenden MOA-ID 1.5.1 Konfiguration mithilfe der Import Funktion des Modules MOA-ID-Configuration. Danach sollten sowohl die allgemeine Konfiguration als auch die Online-Applikationen eingetragen sein.
  2. -
  3. Allgemeine Konfiguration: Folgende Punkte der allgemeinen Konfiguration müssen auf jeden Fall kontrolliert und eventuell angepasst werden. -
      -
    1. Public URL Prefix: Dieser Parameter MUSS konfiguriert werden.
    2. -
    3. Default BKU-URLs: Die Konfiguration von Default BKU URLs wird empfohlen.
    4. -
    5. Security-Layer Request Templates: Dieser Parameter MUSS konfiguriert werden.
    6. -
    7. Single Sign-On Einstellungen
    8. -
    9. PVP 2.1 Konfiguration
    10. -
    11. Security-Layer Transformation: Sollte die Security-Layer Transformation (siehe Kapitel 1.3.1.9) nicht korrekt importiert worden sein (Dateiname ist leer) muss diese neu hochgeladen werden. Die aktuelle Transformation befindet sich in der MOA-ID-Auth Defaultkonfiguration im Ordner /conf/moa-id/transforms/ TransformsInfoAuthBlockTable_DE_2.0.xml
    12. -
    -
  4. -
  5. 5. Online-Applikationen: Je nachdem welche Authentifizierungsprotokolle verwendet werden oder wenn Single Sign-On nicht unterstützen werden soll sind Änderungen an der Online-Applikationskonfiguration erforderlich. Hierfür muss die jeweilige Online-Applikation aus der Liste der Online-Applikationen auswählen und die jeweiligen Parameter anpassen. -
      -
    1. Single Sign-On: Standardmäßig ist Single Sign-On aktiviert.
    2. -
    3. PVP2 Konfiguration: Soll für die Authentifizierung das PVP2.1 Protokoll verwendet werden, so müssen die PVP2 spezifischen Parameter bei der jeweiligen Online-Applikation eingetragen werden.
    4. -
    5. OponID Connect Konfiguration: Soll für die Authentifizierung das Protokoll OpenID Connect verwendet werden, so müssen alle OpenID Connect spezifischen Parameter bei der jeweiligen Online-Applikation hinterlegt werden.
    6. -
    7. BKU Konfiguration: Soll für die Online-Applikation spezielle BKU Instanzen verwendet werden, so müssen diese für die Online-Applikation konfiguriert werden. Diese Konfiguration ist auf bei Verwendung von SAML1 als Authentifizierungsprotokoll erforderlich. Nähere Informationen finden Sie im jeweiligen Kapitel der Dokumentation.
    8. -
    -
  6. -
  7. Wenn alle Änderungen und Anpassungen abgeschlossen wurden wird ein Neustart des Tomcat, welcher das Module MOA-ID-Auth beinhaltet, empfohlen. Nach dem erfolgreichen Neustart steht die Anmeldung an den registrierten Online-Applikationen bereits zur Verfügung. Sollte das Module MOA-ID-Auth nicht erfolgreich starten, muss die Konfiguration, je nach gemeldetem Fehler, ergänzt oder geändert werden.
  8. -
+
  • Exportieren Sie die aktuell in MOA-ID 2.x.x verwendete Konfiguration mit Hilfe der Import/Export Funktionen im Konfigurationstool der MOA-ID Version 2.x.x in eine XML Datei. Diese in eine XML Datei exportierte Konfiguration dient als Basis für die Konvertierung in das neue Format.
  • +
  • Konvertieren der Konfigurationsdatei in das neue Konfigurationsformat von MOA-ID 3.x. Die Konvertierung erfolgt mit Hilfe eines Java Programms aus der Konsole. Hierfür befindet sich im Release Package das Verzeichnis $MOA_ID_AUTH_INST/migration welches alle benötigten Java Bibliotheken beinhaltet. Das Programm kann mit Hilfe des nachfolgenden Kommantozeilenparameters gestartet werden. +
    +
    java -jar moa-id-commons.jar -in ../URL_ZUR_MOA-ID-2.x.x-Config -out ./MOA-ID-3.x.properties
    + Hierbei wird die unter + ../URL_ZUR_MOA-ID-2.x.x-Config verfügbare Konfiguration in das neue Format umgewandelt und in der Datei ./MOA-ID-3.x.properties gespeichert.
  • +
  • Schreiben der konvertierten Konfiguration in die neue Konfigurationstabelle der Datenbank. Dies erfolgt ebenfall mit Hilfe des mitgelieferten Konsolenprogramms, welches mit dem nachstehenden Kommantozeilenparameter gestartet wird. +
    java -jar moa-id-commons.jar -in ./MOA-ID-3.x.properties -outdb ./moa-id-webgui.properties
    + Hierbei wird die unter ./MOA-ID-3.x.properties verfügbare Konfiguration in die Datenbank geschrieben. Die Zugriffsparameter für den Datenbankzugriff werden aus der Konfigurationsdatei ./moa-id-webgui.properties entnommen, welche Identisch zur Konfiguration des neuen MOA-ID-Configuration Tools der Version 3.0 ist.
  • + +

    Hinweis: Zusätzlich besteht auch weiterhin die Möglichkeit eine MOA-ID 2.x.x Konfiguration über die Import/Export Funktion im Konfigurationstool zu importieren. Der Import einer Konfiguration kann jedoch eine längere Zeit in Anspruch nehmen wodurch TimeOut Problemen im Browser möglich sind.

    4 Templates

    Dieser Abschnitt spezifiziert den Mindestaufbau der Templates für die BKU Auswahl, die Single Sign-On Anmeldeabfrage und die Security-Layer Request Templates welche vo Module MOA-ID-Auth verwendet werden. Alle hier beschriebenen Templates werden durch MOA-ID-Auth geladen, erweitert und gegeben falls der Benutzerin oder dem Benutzer im Web-Browser dargestellt. Um einen korrekten Anmeldeprozess zu gewährleisten müssen diese Templates mindestens folgende Formvorschriften und Strukturen aufweisen.

    -

    4.1 B\FCrgerkartenauswahl

    +

    4.1 Bürgerkartenauswahl

    Das BKU Template dient im Anmeldeprozess der Auswahl der gewünschten Bürgerkatenumgebung oder Handysignatur. Nach erfolgter Auswahl durch die Benutzer oder dem Benutzer wird diese an MOA-ID-Auth übermittelt.

    Hinweis: In der Datei ./htmlTemplates/loginFormFull.html welcher sich relativ zur MOA-ID-Auth Konfigurationsdatei befindet finden Sie das Standard Template welches für den Anmeldevorgang verwendet wird, wenn kein online-applikationsspezifisches Template hinterlegt wurde. Dieses Standard Template unterstützt Responsive Design und passt sich somit in einem weiten Bereich an die aktuelle Fenstergröße an.

    Für die Übermittlung an MOA-ID-Auth ist ein http GET Request vorgesehen welcher folgende Parameter unterstützt. Die URL dieses http GET Request wird automatisiert über den Parameter „#AUTH_URL#“ (ohne „“) eingetragen und muss nicht manuell hinterlegt werden. Folgende http GET Parameter werden für die BKU-Auswahl akzeptiert.

    diff --git a/id/server/doc/handbook/install/install.html b/id/server/doc/handbook/install/install.html index f669af2a6..aa4114539 100644 --- a/id/server/doc/handbook/install/install.html +++ b/id/server/doc/handbook/install/install.html @@ -105,7 +105,7 @@
    Installation von Apache Tomcat
    Installieren Sie Apache Tomcat in ein Verzeichnis, das keine Leerzeichen im Pfadnamen enthält. Verwenden Sie bitte die zu Ihrer Java SE passende Distribution von Tomcat. Das Wurzelverzeichnis der Tomcat-Installation wird im weiteren Verlauf als $CATALINA_HOME bezeichnet.
    Entpacken der MOA-ID-Auth Webservice Distribution
    -
    Entpacken Sie die Datei moa-id-auth-2.0.0.zip in ein beliebiges Verzeichnis. Dieses Verzeichnis wird im weiteren Verlauf als $MOA_ID_AUTH_INST bezeichnet.
    +
    Entpacken Sie die Datei moa-id-auth-3.0.0.zip in ein beliebiges Verzeichnis. Dieses Verzeichnis wird im weiteren Verlauf als $MOA_ID_AUTH_INST bezeichnet.
    Installation der Kryptographiebibliotheken von SIC/IAIK

    Kopieren Sie alle Dateien aus dem Verzeichnis $MOA_ID_AUTH_INST/ext in das Verzeichnis $JAVA_HOME/jre/lib/ext. Zusätzlich müssen Sie die Rechtedateien Ihrer Java SE austauschen. Laden Sie dazu die passenden Unlimited Strength @@ -114,7 +114,7 @@ Jurisdiction Policy Files von der Java SE Downloadseite und achten Sie darauf die für ihre verwendete Java SE Installation richtige Version zu nehmen. Anschließend folgen Sie der darin enthaltenen Installationsanweisung.

    Installation einer Datenbank
    -
    Für den Betrieb von MOA-ID 2.0 wird eine Datenbank benötigt, wobei mySQL als Datenbank empfohlen wird (wurde mit mySQL getestet). Der Einsatz eines alternativen Datenbanksystems ist jedoch ebenfalls möglich. Für den Betrieb werden mindestens zwei getrennte Datenbank Schema benötig, da die Konfiguration und die Session Informationen getrennt abgelegt werden. Erstellen Sie zwei Datenbank Schemas welche von MOA-ID-Auth verwendet werden sollen. Deren Namen können z.B. auf moa-id-session für Sessiondaten und moa-id-config für die Konfiguration lauten. Beliebige andere Namen für die Datenbank Schema sind jedoch auch möglich. +
    Für den Betrieb von MOA-ID 3.x wird eine Datenbank benötigt, wobei mySQL als Datenbank empfohlen wird (wurde mit mySQL getestet). Der Einsatz eines alternativen Datenbanksystems ist jedoch ebenfalls möglich. Für den Betrieb werden mindestens zwei getrennte Datenbank Schema benötig, da die Konfiguration und die Session Informationen getrennt abgelegt werden. Erstellen Sie zwei Datenbank Schemas welche von MOA-ID-Auth verwendet werden sollen. Deren Namen können z.B. auf moa-id-session für Sessiondaten und moa-id-config für die Konfiguration lauten. Beliebige andere Namen für die Datenbank Schema sind jedoch auch möglich.
    2.1.2.2 Konfiguration von Apache Tomcat
    @@ -143,6 +143,7 @@
  • moa.spss.server.configuration: Pfad und Name der zentralen Konfigurationsdatei für MOA SP/SS. Eine beispielhafte Konfigurationsdatei finden Sie hier. Wird ein relativer Pfad angegeben, wird dieser relativ zum Startverzeichnis der Java Virtual Machine interpretiert. Ist diese System Property nicht gesetzt, wird automatisch eine im Webarchiv unter WEB-INF/conf enthaltene Default-Konfiguration herangezogen.
  • eu.stork.samlengine.config.location: Pfad auf den Ordner mit den zentralen Konfigurationsdateien für STORK. Die Beispielkonfiguration für das Modul MOA-ID-Auth enthält bereits den Ordner für die STORK Konfiguration.
  • log4j.configuration: URL der Log4j Konfigurationsdatei. Eine beispielhafte Log4j-Konfiguration finden Sie hier. Wird eine relative URL angegeben, wird diese als File-URL relativ zum Startverzeichnis der Java Virtual Machine interpretiert. Ist diese System Property nicht gesetzt, wird automatisch eine im Webarchiv unter WEB-INF/classes enthaltene Default-Konfiguration herangezogen.
  • +
  • -Dlogback.configurationFile: URL der LogBack Konfigurationsdatei. Eine beispielhafte LobBack-Konfiguration finden Sie hier. Wird eine relative URL angegeben, wird diese als File-URL relativ zum Startverzeichnis der Java Virtual Machine interpretiert. Ist diese System Property nicht gesetzt, wird automatisch eine im Webarchiv unter WEB-INF/classes enthaltene Default-Konfiguration herangezogen. Überdies besteht die Möglichkeit eine bestehende Log44 Konfigurationsdatei in der LogBack Format zu überführen (http://logback.qos.ch/translator/).
  • javax.net.ssl.trustStore: Pfad und Dateiname des Truststores für vertrauenswürdige SSL Zertifikate. Die SSL Serverzertifikate der Server von denen mittels https Dateien bezogen werden müssen im Truststore abgelegt werden. Ein relativer Pfad werden relativ zum Startverzeichnis der Java Virtual Machine interpretiert.
  • javax.net.ssl.trustStorePassword: Passwort für den Truststore (optional; nur, wenn SSL Client-Authentisierung durchgeführt werden soll).
  • javax.net.ssl.trustStoreType: Truststore-Typ (optional; nur, wenn SSL Client-Authentisierung durchgeführt werden soll). Je nach verwendetem Keystore-Typ muss jks (Java Key Store) oder pkcs12 (PKCS#12-Datei) angegeben werden.
  • @@ -151,14 +152,16 @@
    2.1.2.4 Einsatz des Moduls MOA-ID-Configuration in Tomcat
      -
    • Die Datei $MOA_ID_AUTH_INST/moa-id_configuration.war enthält das einsatzfertige MOA-ID-Configuration Webarchiv und muss ins Verzeichnis $CATALINA_HOME/webapps kopiert werden. Dort wird sie beim ersten Start von Tomcat automatisch ins Verzeichnis $CATALINA_HOME/webapps/moa-id-configuration entpackt.
    • +
    • Die Datei $MOA_ID_AUTH_INST/egiz-configuration-webapp.war enthält das einsatzfertige MOA-ID-Configuration Webarchiv und muss ins Verzeichnis $CATALINA_HOME/webapps kopiert werden. Dort wird sie beim ersten Start von Tomcat automatisch ins Verzeichnis $CATALINA_HOME/webapps/egiz-configuration-webapp entpackt.
    • Die Konfigurationsdatei mit der Basiskonfiguration für MOA-ID-Auth und die zugehörigen Verzeichnisse müssen in ein beliebiges Verzeichnis im Dateisystem kopiert werden (z.B. $CATALINA_HOME/conf/moa-id-configuration). Eine funktionsfähige Konfiguration, die als Ausgangspunkt für die Basiskonfiguration des MOA-ID-Auth Modules dienen kann, finden Sie hier.
    • Die Dateien xalan.jar, xercesImpl.jar, serializer.jar und xml-apis.jar aus dem Verzeichnis $MOA_ID_AUTH_INST/endorsed müssen in das Tomcat-Verzeichnis $CATALINA_HOME/endorsed (bzw. $CATALINA_HOME/common/endorsed bis Apache Tomcat Version 5.5) kopiert werden. Sind gleichnamige Dateien dort bereits vorhanden, müssen sie überschrieben werden. Die ggf. in diesem Verzeichnis vorhandene Datei xmlParserAPIs.jar muss gelöscht werden. Sollte das Verzeichnis endorsed nicht vorhanden sein, dann muss dieses zuerst erstellt werden.
    • Folgende System Properties können gesetzt werden (wird beim Starten von Tomcat der Java Virtual Machine in der Umgebungsvariablen CATALINA_OPTS in der Form -D<name>=<wert> übergeben):
      • moa.id.webconfig: Pfad und Name der Basiskonfigurationsdatei für MOA-ID-Configuration. Eine beispielhafte Konfigurationsdatei finden Sie hier. Wird ein relativer Pfad angegeben, wird dieser relativ zum Startverzeichnis der Java Virtual Machine interpretiert.
      • +
      • -Duser.properties: Pfad und Name der Basiskonfigurationsdatei für das Usermanagement der Konfigurationsoberfläche. Eine beispielhafte Konfigurationsdatei finden Sie hier. Wird ein relativer Pfad angegeben, wird dieser relativ zum Startverzeichnis der Java Virtual Machine interpretiert.
      • log4j.configuration: URL der Log4j Konfigurationsdatei. Eine beispielhafte Log4j-Konfiguration finden Sie hier. Wird eine relative URL angegeben, wird diese als File-URL relativ zum Startverzeichnis der Java Virtual Machine interpretiert. Ist diese System Property nicht gesetzt, wird automatisch eine im Webarchiv unter WEB-INF/classes enthaltene Default-Konfiguration herangezogen.
      • +
      • -Dlogback.configurationFile: URL der LogBack Konfigurationsdatei. Eine beispielhafte LobBack-Konfiguration finden Sie hier. Wird eine relative URL angegeben, wird diese als File-URL relativ zum Startverzeichnis der Java Virtual Machine interpretiert. Ist diese System Property nicht gesetzt, wird automatisch eine im Webarchiv unter WEB-INF/classes enthaltene Default-Konfiguration herangezogen. Überdies besteht die Möglichkeit eine bestehende Log44 Konfigurationsdatei in der LogBack Format zu überführen (http://logback.qos.ch/translator/).
      • javax.net.ssl.trustStore: Pfad und Dateiname des Truststores für vertrauenswürdige SSL Zertifikate Die SSL Serverzertifikate der Server von denen mittels https Dateien bezogen werden müssen im Truststore abgelegt werden. Ein relativer Pfad werden relativ zum Startverzeichnis der Java Virtual Machine interpretiert.
      • javax.net.ssl.trustStorePassword: Passwort für den Truststore (optional; nur, wenn SSL Client-Authentisierung durchgeführt werden soll).
      • javax.net.ssl.trustStoreType: Truststore-Typ (optional; nur, wenn SSL Client-Authentisierung durchgeführt werden soll). Je nach verwendetem Keystore-Typ muss jks (Java Key Store) oder pkcs12 (PKCS#12-Datei) angegeben werden.
      • @@ -184,17 +187,17 @@ gestartet werden. Das Stoppen von Tomcat erfolgt analog mit
        32131 [localhost-startStop-1] INFO moa.id.auth  - MOA ID Authentisierung wurde erfolgreich gestartet 
         32131 [localhost-startStop-1] INFO moa.id.auth  - Dispatcher Servlet initialization finished.

        Analog bei MOA-ID-Configuration

        -
        INFO at.gv.egovernment.moa.id.configuration.config.ConfigurationProvider  - MOA-ID-Configuration initialization completed
        +
        INFO | 21 10:16:22 | localhost-startStop-1 | Loading config module: MOAIDConfigurationModul

        Bei leichten Fehlern in der Konfiguration geben WARN Log-Meldungen unmittelbar davor Aufschluss über fehlerhafte Konfigurations-Einträge. Nach dem Starten von Tomcat stehen MOA-ID-Auth und MOA-ID-Configuration zur Verfügung. Die Einsprungspunkte der unterschiedlichen Authentifizierungsprotokolle von MOA-ID-Auth werden im Abschnitt Protokolle im Detail beschrieben.

         http://<host>:<port>/moa-id-auth/
        -http://<host>:<port>/moa-id-configuration/
        +http://<host>:<port>/egiz-configuration-webapp/

        bzw.

         https://<host>:<port>/moa-id-auth/
        -https://<host>:<port>/moa-id-configuration/
        +https://<host>:<port>/egiz-configuration-webapp/

        Die Verfügbarkeit des Services können Sie einfach überprüfen, indem Sie die Endpunkte mit einem Web-Browser aufgerufen; dies sollte nach erfolgreichem Start zur Anzeige einer Informationsseite führen.

        2.1.3 Logging

        Beide Module verwenden Log4j für die Ausgabe von Log-Meldungen am Bildschirm bzw. in Log-Dateien. Log4j bietet zahlreiche Konfigurationsmöglichkeiten, die ausführlich im Log4j Handbuch beschrieben sind. Unter anderem gibt es die Möglichkeit, folgende Einstellungen vorzunehmen: @@ -212,12 +215,18 @@ https://<host>:<port>/moa-id-configuration/

        Hierbei werden folgende Log-Hierarchien verwendet:

        • -

          at.gv.egovernment.moa.id.configuration für alle Log-Meldungen aus MOA-ID-Configuration

          +

          at.gv.egiz.components.configuration für Log-Meldungen aus allgemeinen EGIZ KonfigurationsGUI

        • -
        • moa.id.auth für alle Log-Meldungen aus MOA-ID-Auth
        • -

          moa.spss.server für alle Log-Meldungen aus dem MOA/SPSS

          +

          at.gv.egovernment.moa.id.configuration für Log-Meldungen aus MOA-ID Configurationsmodul

        • +
        • at.gv.egovernment.moa.id für alle Log-Meldungen aus MOA-ID-Auth
        • +
        • +

          at.gv.egovernment.moa.spss für alle Log-Meldungen aus dem MOA/SPSS

          +
        • +
        • +

          at.gv.egiz.eventlog.plain.all für alle Log-Meldungen aus dem MOA-ID EventLog zur Revisionssicherung

          +
        • iaik.server für alle Log-Meldungen aus den SIC/IAIK Kryptographie-Modulen.

        • diff --git a/id/server/doc/htmlTemplates/BKU-selection.html b/id/server/doc/htmlTemplates/BKU-selection.html index d0af6401b..123a23837 100644 --- a/id/server/doc/htmlTemplates/BKU-selection.html +++ b/id/server/doc/htmlTemplates/BKU-selection.html @@ -15,13 +15,17 @@ text-align: center; background-color: #6B7B8B; } + + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU p { font-size: 0.7em; } #localBKU input{ - font-size: 0.7em; + font-size: 0.85em; /*border-radius: 5px;*/ } @@ -142,6 +146,8 @@ margin-bottom: 10px; } + + #validation { position: absolute; bottom: 0px; @@ -154,7 +160,10 @@ @media screen and (max-width: 205px) { #localBKU p { font-size: 0.6em; - } + } + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.6em; @@ -191,6 +200,9 @@ #localBKU p { font-size: 0.7em; } + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.7em; @@ -227,6 +239,9 @@ #localBKU p { font-size: 0.9em; } + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.8em; @@ -257,7 +272,9 @@ #localBKU p { font-size: 0.9em; } - + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.8em; min-width: 70px; @@ -288,7 +305,9 @@ #localBKU p { font-size: 0.9em; } - + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.8em; min-width: 70px; @@ -327,7 +346,9 @@ font-size: 100%; background-color: #MAIN_BACKGOUNDCOLOR#; } - + .browserInfoButton{ + color: rgb(128, 128, 128); + } #page { visibility: hidden; margin-top: 0%; @@ -464,12 +485,11 @@ } #localBKU { - padding-left: 5%; - padding-right: 2%; padding-bottom: 4%; /*padding-top: 4%;*/ position: relative; - clear: both; + clear: both; + text-align: center; } #bkukarte { @@ -526,13 +546,13 @@ #localBKU input { /* color: #BUTTON_COLOR#; */ - border: 0px; + /*border: 0px;*/ display: inline-block; } #localBKU input:hover, #localBKU input:focus, #localBKU input:active { - text-decoration: underline; + /*text-decoration: underline;*/ } #installJava, #BrowserNOK { @@ -727,6 +747,56 @@ } } + + function checkIfBrowserSupportsJava(){ + console.log("Browser is Chrome: "+checkIfBrowserIsChrome()); + console.log("Browser is Safari: "+checkIfBrowserIsSafari()); + console.log("Browser is Edge: "+checkIfBrowserIsEdge()); + + var cnt = 0; + + if(checkIfBrowserIsChrome())cnt++; + if(checkIfBrowserIsEdge())cnt++; + if(checkIfBrowserIsSafari())cnt++; + + if(cnt==0 || cnt>1)//cnt>1 means perhaps wrong detection + return true; + + var image = document.getElementById("bkuimage"); + var srcatt = image.getAttribute("src"); + var last = srcatt.substring(srcatt.lastIndexOf('/')+1); + srcatt = srcatt.replace(last,'online-bku-deactivated.png'); + image.setAttribute("src",srcatt); + + + var button = document.getElementsByName("bkuButtonOnline")[0]; + button.setAttribute("class","browserInfoButton"); + button.setAttribute("title","Java wird nicht unterstützt, klicken für mehr Informationen."); + button.setAttribute("onClick","alert('Java wird von Ihrem Browser nicht unterstützt, ist jedoch für den Betrieb der Online Bürgerkartenumgebung notwendig.\\nWollen Sie dennoch die Online Bürgerkartenumgebung verwenden, wird zur Zeit Java noch von Firefox und MS Internet Explorer unterstützt. \\nAlternativ koennen Sie auch eine lokale Bürgerkartenumgebung verwenden, verfügbar unter www.buergerkarte.at.');"); + + return false; + + } + function checkIfBrowserIsChrome(){ + var chrome_defined = !!window.chrome;//chrome object defined + var webstore_defined = false; + if(window.chrome){ + webstore_defined = !!window.chrome.webstore; + } + return chrome_defined && webstore_defined; + } + function checkIfBrowserIsEdge(){//edge also defines the chrome object, but not the webapp + var chrome_defined = !!window.chrome;//chrome object defined + var webstore_defined = true; + if(window.chrome){ + webstore_defined = !!window.chrome.webstore; + } + return chrome_defined && !webstore_defined; + } + function checkIfBrowserIsSafari(){ + var cond1 = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; + return cond1; + } /* function setSSOSelection() { document.getElementById("useSSO").value = "false"; var checkbox = document.getElementById("SSOCheckBox"); @@ -754,7 +824,7 @@ Anmeldung mittels Bürgerkarte oder Handy-Signatur - +

          Anmeldung an: #OAName#

          @@ -779,7 +849,7 @@
          - OnlineBKU @@ -801,9 +871,8 @@ name="MODUL" value="#MODUL#"> - provided + + + serializer + xalan + + xerces diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationProviderImpl.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationProviderImpl.java index 113e9cdda..60d676868 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationProviderImpl.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/ConfigurationProviderImpl.java @@ -121,7 +121,7 @@ public abstract class ConfigurationProviderImpl implements ConfigurationProvider protected Map genericConfiguration; /** The default chaining mode. */ - protected String defaultChainingMode; + protected String defaultChainingMode = "pkix"; /** * A Map which contains the IssuerAndSerial to diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java index f7b6b8dde..4d88caffc 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/entrypoints/DispatcherServlet.java @@ -287,6 +287,7 @@ public class DispatcherServlet extends AuthServlet{ MOAReversionLogger.getInstance().logEvent(MOAIDEventConstants.SESSION_CREATED, uniqueSessionIdentifier); MOAReversionLogger.getInstance().logEvent(MOAIDEventConstants.TRANSACTION_CREATED, protocolRequestID); MOAReversionLogger.getInstance().logEvent(uniqueSessionIdentifier, protocolRequestID, MOAIDEventConstants.TRANSACTION_IP, req.getRemoteAddr()); + protocolRequest = info.preProcess(req, resp, action, uniqueSessionIdentifier, protocolRequestID); MOAReversionLogger.getInstance().logEvent(protocolRequest.getOnlineApplicationConfiguration(), diff --git a/id/server/idserverlib/src/main/resources/resources/templates/loginFormFull.html b/id/server/idserverlib/src/main/resources/resources/templates/loginFormFull.html index e293d8456..123a23837 100644 --- a/id/server/idserverlib/src/main/resources/resources/templates/loginFormFull.html +++ b/id/server/idserverlib/src/main/resources/resources/templates/loginFormFull.html @@ -15,13 +15,17 @@ text-align: center; background-color: #6B7B8B; } + + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU p { font-size: 0.7em; } #localBKU input{ - font-size: 0.7em; + font-size: 0.85em; /*border-radius: 5px;*/ } @@ -142,6 +146,8 @@ margin-bottom: 10px; } + + #validation { position: absolute; bottom: 0px; @@ -154,7 +160,10 @@ @media screen and (max-width: 205px) { #localBKU p { font-size: 0.6em; - } + } + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.6em; @@ -191,6 +200,9 @@ #localBKU p { font-size: 0.7em; } + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.7em; @@ -227,6 +239,9 @@ #localBKU p { font-size: 0.9em; } + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.8em; @@ -257,7 +272,9 @@ #localBKU p { font-size: 0.9em; } - + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.8em; min-width: 70px; @@ -288,7 +305,9 @@ #localBKU p { font-size: 0.9em; } - + .browserInfoButton{ + color: rgb(128, 128, 128); + } #localBKU input { font-size: 0.8em; min-width: 70px; @@ -327,7 +346,9 @@ font-size: 100%; background-color: #MAIN_BACKGOUNDCOLOR#; } - + .browserInfoButton{ + color: rgb(128, 128, 128); + } #page { visibility: hidden; margin-top: 0%; @@ -464,12 +485,11 @@ } #localBKU { - padding-left: 5%; - padding-right: 2%; padding-bottom: 4%; /*padding-top: 4%;*/ position: relative; - clear: both; + clear: both; + text-align: center; } #bkukarte { @@ -526,13 +546,13 @@ #localBKU input { /* color: #BUTTON_COLOR#; */ - border: 0px; + /*border: 0px;*/ display: inline-block; } #localBKU input:hover, #localBKU input:focus, #localBKU input:active { - text-decoration: underline; + /*text-decoration: underline;*/ } #installJava, #BrowserNOK { @@ -720,13 +740,63 @@ } } function onChangeChecks() { - if (self.innerWidth < 650) { + if (top.innerWidth < 650) { document.getElementById("moaidform").setAttribute("target","_parent"); } else { document.getElementById("moaidform").removeAttribute("target"); } } + + function checkIfBrowserSupportsJava(){ + console.log("Browser is Chrome: "+checkIfBrowserIsChrome()); + console.log("Browser is Safari: "+checkIfBrowserIsSafari()); + console.log("Browser is Edge: "+checkIfBrowserIsEdge()); + + var cnt = 0; + + if(checkIfBrowserIsChrome())cnt++; + if(checkIfBrowserIsEdge())cnt++; + if(checkIfBrowserIsSafari())cnt++; + + if(cnt==0 || cnt>1)//cnt>1 means perhaps wrong detection + return true; + + var image = document.getElementById("bkuimage"); + var srcatt = image.getAttribute("src"); + var last = srcatt.substring(srcatt.lastIndexOf('/')+1); + srcatt = srcatt.replace(last,'online-bku-deactivated.png'); + image.setAttribute("src",srcatt); + + + var button = document.getElementsByName("bkuButtonOnline")[0]; + button.setAttribute("class","browserInfoButton"); + button.setAttribute("title","Java wird nicht unterstützt, klicken für mehr Informationen."); + button.setAttribute("onClick","alert('Java wird von Ihrem Browser nicht unterstützt, ist jedoch für den Betrieb der Online Bürgerkartenumgebung notwendig.\\nWollen Sie dennoch die Online Bürgerkartenumgebung verwenden, wird zur Zeit Java noch von Firefox und MS Internet Explorer unterstützt. \\nAlternativ koennen Sie auch eine lokale Bürgerkartenumgebung verwenden, verfügbar unter www.buergerkarte.at.');"); + + return false; + + } + function checkIfBrowserIsChrome(){ + var chrome_defined = !!window.chrome;//chrome object defined + var webstore_defined = false; + if(window.chrome){ + webstore_defined = !!window.chrome.webstore; + } + return chrome_defined && webstore_defined; + } + function checkIfBrowserIsEdge(){//edge also defines the chrome object, but not the webapp + var chrome_defined = !!window.chrome;//chrome object defined + var webstore_defined = true; + if(window.chrome){ + webstore_defined = !!window.chrome.webstore; + } + return chrome_defined && !webstore_defined; + } + function checkIfBrowserIsSafari(){ + var cond1 = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; + return cond1; + } /* function setSSOSelection() { document.getElementById("useSSO").value = "false"; var checkbox = document.getElementById("SSOCheckBox"); @@ -754,7 +824,7 @@ Anmeldung mittels Bürgerkarte oder Handy-Signatur - +

          Anmeldung an: #OAName#

          @@ -779,7 +849,7 @@
          - OnlineBKU @@ -801,9 +871,8 @@ name="MODUL" value="#MODUL#"> - + mysql mysql-connector-java diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java index 4ff18e938..5233aa5d8 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java @@ -134,6 +134,17 @@ public class ConfigurationMigrationUtils { result.put(MOAIDConfigurationConstants.SERVICE_BUSINESSSERVICE, Boolean.FALSE.toString()); + //revisionsLog + if (oa.getIsRevisionsLogActive() == null) + result.put(MOAIDConfigurationConstants.SERVICE_REVERSION_LOGS_ENABLED, Boolean.FALSE.toString()); + else + result.put(MOAIDConfigurationConstants.SERVICE_REVERSION_LOGS_ENABLED, oa.getIsRevisionsLogActive().toString()); + + if (MiscUtil.isNotEmpty(oa.getEventCodes())) { + result.put(MOAIDConfigurationConstants.SERVICE_REVERSION_LOGS_EVENTCODES, oa.getEventCodes()); + } + + //convert target String target_full = oa.getTarget(); if (MiscUtil.isNotEmpty(target_full)) { @@ -267,7 +278,9 @@ public class ConfigurationMigrationUtils { EncBPKInformation bPKEncDec = oaauth.getEncBPKInformation(); if (bPKEncDec != null) { BPKDecryption bPKDec = bPKEncDec.getBPKDecryption(); - if (bPKDec != null) { + if (bPKDec != null + && MiscUtil.isNotEmpty(bPKDec.getKeyInformation()) + && MiscUtil.isNotEmpty(bPKDec.getIv())) { result.put(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_BLOB, Base64Utils.encode(bPKDec.getKeyInformation())); result.put(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_IV, Base64Utils.encode(bPKDec.getIv())); @@ -297,7 +310,7 @@ public class ConfigurationMigrationUtils { //convert interfederation configuration InterfederationIDPType moaIDP = oa.getInterfederationIDP(); - if (moaIDP != null) { + if (moaIDP != null && oa.isIsInterfederationIDP() != null && oa.isIsInterfederationIDP()) { result.put(MOAIDConfigurationConstants.PREFIX_SERVICES, MOAIDConfigurationConstants.PREFIX_IIDP); result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_ATTRIBUTQUERY_URL, moaIDP.getAttributeQueryURL()); @@ -316,7 +329,7 @@ public class ConfigurationMigrationUtils { //convert STORK <-> PVP2X gateway configuration InterfederationGatewayType gateway = oa.getInterfederationGateway(); - if (gateway != null) { + if (gateway != null && oa.isIsInterfederationGateway() != null && oa.isIsInterfederationGateway()) { result.put(MOAIDConfigurationConstants.PREFIX_SERVICES, MOAIDConfigurationConstants.PREFIX_GATEWAY); result.put(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_FORWARD_IDPIDENTIFIER, gateway.getForwardIDPIdentifier()); @@ -408,7 +421,7 @@ public class ConfigurationMigrationUtils { result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST + "." + String.valueOf(listCounter) + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST_ENABLED, - Boolean.TRUE.toString()); + Boolean.FALSE.toString()); result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_COUNTRIES_LIST + "." + String.valueOf(listCounter) + "." @@ -471,7 +484,7 @@ public class ConfigurationMigrationUtils { result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST + "." + String.valueOf(listCounter) + "." + MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST_REQUESTED, - Boolean.TRUE.toString()); + Boolean.FALSE.toString()); result.put(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ATTRIBUTES_LIST + "." + String.valueOf(listCounter) + "." @@ -707,6 +720,12 @@ public class ConfigurationMigrationUtils { dbOA.setPublicURLPrefix(oa.get(MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER)); dbOA.setFriendlyName(oa.get(MOAIDConfigurationConstants.SERVICE_FRIENDLYNAME)); + if (oa.containsKey(MOAIDConfigurationConstants.SERVICE_REVERSION_LOGS_ENABLED)) { + dbOA.setIsRevisionsLogActive(Boolean.valueOf(oa.get(MOAIDConfigurationConstants.SERVICE_REVERSION_LOGS_ENABLED))); + dbOA.setEventCodes(oa.get(MOAIDConfigurationConstants.SERVICE_REVERSION_LOGS_EVENTCODES)); + + } + if (Boolean.valueOf(oa.get(MOAIDConfigurationConstants.SERVICE_BUSINESSSERVICE))) { dbOA.setType(MOA_CONFIG_BUSINESSSERVICE); @@ -714,13 +733,16 @@ public class ConfigurationMigrationUtils { if (idnumber == null) idnumber = new IdentificationNumber(); - if (oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE).equals(MOAIDConfigurationConstants.IDENIFICATIONTYPE_STORK)) { - idnumber.setValue(MOAIDConfigurationConstants.PREFIX_STORK + "AT" + "+" + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_VALUE)); - idnumber.setType(MOAIDConfigurationConstants.BUSINESSSERVICENAMES.get(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE))); - } else { - idnumber.setValue(MOAIDConfigurationConstants.PREFIX_WPBK + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE) + "+" + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_VALUE)); - idnumber.setType(MOAIDConfigurationConstants.BUSINESSSERVICENAMES.get(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE))); - } + if (oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE) != null && + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_VALUE) != null) { + if (oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE).equals(MOAIDConfigurationConstants.IDENIFICATIONTYPE_STORK)) { + idnumber.setValue(MOAIDConfigurationConstants.PREFIX_STORK + "AT" + "+" + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_VALUE)); + idnumber.setType(MOAIDConfigurationConstants.BUSINESSSERVICENAMES.get(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE))); + } else { + idnumber.setValue(MOAIDConfigurationConstants.PREFIX_WPBK + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE) + "+" + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_VALUE)); + idnumber.setType(MOAIDConfigurationConstants.BUSINESSSERVICENAMES.get(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_BUSINESS_TYPE))); + } + } authoa.setIdentificationNumber(idnumber); @@ -735,16 +757,17 @@ public class ConfigurationMigrationUtils { } else { String target = oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET); + if (MiscUtil.isNotEmpty(target)) { + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET_SUB)) + && Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_USE_SUB))) + dbOA.setTarget(target + "-" + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET_SUB)); + else + dbOA.setTarget(target); - if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET_SUB)) - && Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_USE_SUB))) - dbOA.setTarget(target + "-" + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TARGET_PUBLIC_TARGET_SUB)); - else - dbOA.setTarget(target); - - String targetname = TargetValidator.getTargetFriendlyName(target); - if (MiscUtil.isNotEmpty(targetname)) - dbOA.setTargetFriendlyName(targetname); + String targetname = TargetValidator.getTargetFriendlyName(target); + if (MiscUtil.isNotEmpty(targetname)) + dbOA.setTargetFriendlyName(targetname); + } } } @@ -794,7 +817,8 @@ public class ConfigurationMigrationUtils { //store keyBox Identifier - dbOA.setKeyBoxIdentifier(MOAKeyBoxSelector.fromValue(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_KEYBOXIDENTIFIER))); + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_KEYBOXIDENTIFIER))) + dbOA.setKeyBoxIdentifier(MOAKeyBoxSelector.fromValue(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_BKU_KEYBOXIDENTIFIER))); Mandates mandates = new Mandates(); if (Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_MANDATES_OVS_USE))) { @@ -858,14 +882,17 @@ public class ConfigurationMigrationUtils { bPKDec.setKeyStoreFileName(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_FILENAME)); bPKDec.setKeyAlias(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_KEYALIAS)); - try { - bPKDec.setIv(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_IV), false)); - bPKDec.setKeyInformation(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_BLOB), false)); + if (oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_IV) != null && + oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_BLOB) != null) { + try { + bPKDec.setIv(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_IV), false)); + bPKDec.setKeyInformation(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_FOREIGNBPK_DECRYPT_BLOB), false)); - } catch (IOException e) { - Logger.error("Configuration encryption FAILED.", e); - - } + } catch (IOException e) { + Logger.error("Configuration encryption FAILED.", e); + + } + } OASSO sso = authoa.getOASSO(); if (sso == null) { @@ -885,10 +912,11 @@ public class ConfigurationMigrationUtils { } // transfer the incoming data to the database model stork.setStorkLogonEnabled(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_ENABLED))); - stork.setQaa(Integer.valueOf(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_MINQAALEVEL))); - - if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.PREFIX_SERVICES)) - && oa.get(MOAIDConfigurationConstants.PREFIX_SERVICES).equals(MOAIDConfigurationConstants.PREFIX_VIDP)) + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_MINQAALEVEL))) + stork.setQaa(Integer.valueOf(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_MINQAALEVEL))); + + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES)) + && oa.get(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES).equals(MOAIDConfigurationConstants.PREFIX_VIDP)) stork.setVidpEnabled(true); stork.setRequireConsent(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_STORK_REQUIRECONSENT))); @@ -971,13 +999,14 @@ public class ConfigurationMigrationUtils { authoa.setOAPVP2(pvp2); } - try { - pvp2.setCertificate(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_CERTIFICATE), false)); - - } catch (IOException e) { - Logger.warn("Uploaded Certificate can not be parsed", e); +// try { + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_CERTIFICATE))) + pvp2.setCertificate(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_CERTIFICATE).getBytes()); - } +// } catch (IOException e) { +// Logger.warn("Uploaded Certificate can not be parsed", e); +// +// } pvp2.setMetadataURL(oa.get(MOAIDConfigurationConstants.SERVICE_PROTOCOLS_PVP2X_URL)); @@ -998,26 +1027,28 @@ public class ConfigurationMigrationUtils { //store BKU-selection and send-assertion templates if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA))) { TransformsInfoType el1 = new TransformsInfoType(); - try { - el1.setTransformation(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA), false)); +// try { + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA))) + el1.setTransformation(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA).getBytes()); el1.setFilename(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_BKUSELECTION_PREVIEW)); templates.setBKUSelectionTemplate(el1); - } catch (IOException e) { - Logger.warn("Converting BKU selection template FAILED.", e); - } +// } catch (IOException e) { +// Logger.warn("Converting BKU selection template FAILED.", e); +// } } if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA))) { TransformsInfoType el1 = new TransformsInfoType(); - try { - el1.setTransformation(Base64Utils.decode(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA), false)); +// try { + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA))) + el1.setTransformation(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA).getBytes()); el1.setFilename(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SENDASSERTION_PREVIEW)); templates.setSendAssertionTemplate(el1); - } catch (IOException e) { - Logger.warn("Converting Send Assertion template FAILED.", e); - } +// } catch (IOException e) { +// Logger.warn("Converting Send Assertion template FAILED.", e); +// } } BKUSelectionCustomizationType bkuselectioncustom = templates.getBKUSelectionCustomization(); @@ -1050,8 +1081,8 @@ public class ConfigurationMigrationUtils { bkuselectioncustom.setAppletWidth(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_APPLETWIDTH)); - if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.PREFIX_SERVICES)) - && oa.get(MOAIDConfigurationConstants.PREFIX_SERVICES).equals(MOAIDConfigurationConstants.PREFIX_IIDP)) + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES)) + && oa.get(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES).equals(MOAIDConfigurationConstants.PREFIX_IIDP)) dbOA.setIsInterfederationIDP(true); InterfederationIDPType moaIDP = dbOA.getInterfederationIDP(); @@ -1067,8 +1098,8 @@ public class ConfigurationMigrationUtils { moaIDP.setPerformLocalAuthenticationOnError(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_LOCALAUTHONERROR))); moaIDP.setPerformPassivRequest(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_INTERFEDERATION_PASSIVEREQUEST))); - if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.PREFIX_SERVICES)) - && oa.get(MOAIDConfigurationConstants.PREFIX_SERVICES).equals(MOAIDConfigurationConstants.PREFIX_GATEWAY)) + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES)) + && oa.get(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES).equals(MOAIDConfigurationConstants.PREFIX_GATEWAY)) dbOA.setIsInterfederationGateway(true); InterfederationGatewayType gateway = dbOA.getInterfederationGateway(); if (gateway == null) { @@ -1599,31 +1630,38 @@ public class ConfigurationMigrationUtils { for (String key : moaconfig.keySet()) { if (key.startsWith(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST)) { String index = KeyValueUtils.getFirstChildAfterPrefix(key, MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST); - StorkAttribute attr = new StorkAttribute(); - attr.setName(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST - + "." + index + "." - + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_NAME)); - attr.setMandatory(Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST - + "." + index + "." - + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY))); - attrMap.put(index, attr); + if (!attrMap.containsKey(index)) { + StorkAttribute attr = new StorkAttribute(); + attr.setName(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST + + "." + index + "." + + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_NAME)); + attr.setMandatory(Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST + + "." + index + "." + + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_ATTRIBUTES_LIST_MANDATORY))); + attr.setHjid(Long.valueOf(index)); + attrMap.put(index, attr); + } } else if (key.startsWith(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST)) { String index = KeyValueUtils.getFirstChildAfterPrefix(key, MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST); - CPEPS attr = new CPEPS(); - attr.setCountryCode(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST - + "." + index + "." - + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY)); - - attr.setURL(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST - + "." + index + "." - + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL)); - - attr.setSupportsXMLSignature(Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST - + "." + index + "." - + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_SUPPORT_XMLDSIG))); - - cpepsMap.put(index, attr); + if (!cpepsMap.containsKey(index)) { + CPEPS attr = new CPEPS(); + attr.setCountryCode(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + + "." + index + "." + + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_COUNTRY)); + + attr.setURL(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + + "." + index + "." + + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_URL)); + + attr.setSupportsXMLSignature(Boolean.parseBoolean(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST + + "." + index + "." + + MOAIDConfigurationConstants.GENERAL_AUTH_STORK_CPEPS_LIST_SUPPORT_XMLDSIG))); + + attr.setHjid(Long.valueOf(index)); + + cpepsMap.put(index, attr); + } } } @@ -1686,17 +1724,17 @@ public class ConfigurationMigrationUtils { dbauth.setSecurityLayer(seclayertrans); } - try { +// try { List trans = new ArrayList(); TransformsInfoType elem = new TransformsInfoType(); - elem.setTransformation(Base64Utils.decode(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_BASE64), false)); + elem.setTransformation(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_BASE64).getBytes()); elem.setFilename(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_AUTHBLOCK_TRANSFORMATION_NAME)); trans.add(elem); seclayertrans.setTransformsInfo(trans); - } catch (IOException e) { - Logger.warn("Converting AuthBlock transformation FAILED.", e); - } +// } catch (IOException e) { +// Logger.warn("Converting AuthBlock transformation FAILED.", e); +// } SLRequestTemplates slrequesttempl = dbconfig.getSLRequestTemplates(); diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationUtil.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationUtil.java index a9d8d92da..4130b2c5d 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationUtil.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationUtil.java @@ -83,7 +83,7 @@ public class ConfigurationUtil { * is thrown if problem occurred while serializing one of the * database values */ - private Properties moaIdConfigToJsonProperties(MOAIDConfiguration config) throws JsonProcessingException { + public static Properties moaIdConfigToJsonProperties(MOAIDConfiguration config) throws JsonProcessingException { Properties result = new Properties(); diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java index c798a525e..07c3151a2 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java @@ -14,6 +14,7 @@ public final class MOAIDConfigurationConstants extends MOAIDConstants { public static final String METADATA_LIST = "__LI"; public static final String WEBGUI_EMPTY_ELEMENT = "null"; + public static final String WEBGUI_EMPTY_ELEMENT_EMPTY = "empty"; //Basic key namespaces public static final String PREFIX_MOAID = "moa.id"; @@ -84,9 +85,11 @@ public final class MOAIDConfigurationConstants extends MOAIDConstants { public static final String SERVICE_AUTH_TEMPLATES_BKUSELECTION_DATA = SERVICE_AUTH_TEMPLATES + ".bkuselection.data"; public static final String SERVICE_AUTH_TEMPLATES_BKUSELECTION_PREVIEW = SERVICE_AUTH_TEMPLATES + ".bkuselection.preview"; public static final String SERVICE_AUTH_TEMPLATES_BKUSELECTION_FILENAME = SERVICE_AUTH_TEMPLATES + ".bkuselection.filename"; + public static final String SERVICE_AUTH_TEMPLATES_BKUSELECTION_DELETE = SERVICE_AUTH_TEMPLATES + ".bkuselection.delete"; public static final String SERVICE_AUTH_TEMPLATES_SENDASSERTION_DATA = SERVICE_AUTH_TEMPLATES + ".sendAssertion.data"; public static final String SERVICE_AUTH_TEMPLATES_SENDASSERTION_PREVIEW = SERVICE_AUTH_TEMPLATES + ".sendAssertion.preview"; public static final String SERVICE_AUTH_TEMPLATES_SENDASSERTION_FILENAME = SERVICE_AUTH_TEMPLATES + ".sendAssertion.filename"; + public static final String SERVICE_AUTH_TEMPLATES_SENDASSERTION_DELETE = SERVICE_AUTH_TEMPLATES + ".sendAssertion.delete"; private static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION = SERVICE_AUTH_TEMPLATES + ".customize"; public static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_FONTTYPE = SERVICE_AUTH_TEMPLATES_CUSTOMIZATION + ".fonttype"; public static final String SERVICE_AUTH_TEMPLATES_CUSTOMIZATION_BACKGROUNDCOLOR = SERVICE_AUTH_TEMPLATES_CUSTOMIZATION + ".color.back"; diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/MOAIDConfCLI.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/MOAIDConfCLI.java index f2753c3d0..b5bc9d874 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/MOAIDConfCLI.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/cli/MOAIDConfCLI.java @@ -72,7 +72,7 @@ public class MOAIDConfCLI { HelpFormatter formatter = new HelpFormatter(); pOut.println(); pOut.println("usage: " + CLIConstants.CMD_LINE_SYNTAX + " -" + CLIConstants.CLI_PARAM_FORCE + " -" - + CLIConstants.CLI_PARAM_IN + " | -" + CLIConstants.CLI_PARAM_INDB + " -" + + CLIConstants.CLI_PARAM_IN + " -" + CLIConstants.CLI_PARAM_OUT + " | -" + CLIConstants.CLI_PARAM_OUTDB + " [-" + CLIConstants.CLI_PARAM_HELP + "]"); pOut.println(); diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfiguration.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfiguration.java index fbb1597f3..223f29a0b 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfiguration.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfiguration.java @@ -19,6 +19,15 @@ public interface MOAIDConfiguration extends Configuration { * @return All key/value pairs with this prefix or null if no key is found. The prefix is removed from the key. * **/ + public Map getPropertySubset(String preFix, boolean removePrefix) throws ConfigurationException; + + /** + * Get all key/value pairs with a prefix + * + * @param preFix: A key prefix + * @return All key/value pairs with this prefix or null if no key is found. The prefix is removed from the key. + * + **/ public Map getPropertySubset(String preFix) throws ConfigurationException; diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java index 20e2ba598..297c63d7d 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/persistence/MOAIDConfigurationImpl.java @@ -49,9 +49,11 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement } /* (non-Javadoc) - * @see at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration#getPropertySubset(java.lang.String) + * @see at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration#getPropertySubset(java.lang.String, boolean) */ - public Map getPropertySubset(String preFix) throws ConfigurationException{ + @Override + public Map getPropertySubset(String preFix, + boolean removePrefix) throws ConfigurationException { EntityManager em = this.getPersistenceContext(); if (null == em) { Logger.error("No EntityManager set!"); @@ -72,8 +74,15 @@ public class MOAIDConfigurationImpl extends DatabaseConfigPropertyImpl implement //build key/value configuration map from database entries Map result = getKeyValueFromDatabaseDAO( - configResult.iterator(), preFix, true); + configResult.iterator(), preFix, removePrefix); return result; + } + + /* (non-Javadoc) + * @see at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration#getPropertySubset(java.lang.String) + */ + public Map getPropertySubset(String preFix) throws ConfigurationException{ + return getPropertySubset(preFix, true); } diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java index 41c7008e9..4a90d1bce 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBRead.java @@ -1,450 +1,301 @@ -//package at.gv.egovernment.moa.id.commons.db; -// -//import java.util.ArrayList; -//import java.util.Collections; -//import java.util.Date; -//import java.util.List; -//import java.util.Map; -// -//import org.springframework.beans.factory.annotation.Autowired; -// -//import at.gv.egiz.components.configuration.api.ConfigurationException; -//import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; -//import at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration; -//import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; -//import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModes; -//import at.gv.egovernment.moa.id.commons.db.dao.config.DefaultBKUs; -//import at.gv.egovernment.moa.id.commons.db.dao.config.GenericConfiguration; -//import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; -// -//import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; -//import at.gv.egovernment.moa.logging.Logger; -// -///** -// * -// * -// */ -//public class NewConfigurationDBRead { -// -// private static MOAIDConfiguration conf; -// -// @Autowired(required = true) -// public void setConfiguration(MOAIDConfiguration conf) { -// // https://jira.spring.io/browse/SPR-3845 -// NewConfigurationDBRead.conf = conf; -// } -// -// @SuppressWarnings("unchecked") -// public static > T nullGuard(T item) { -// if (item == null) { -// return (T) Collections.emptyList(); -// } else { -// return item; -// } -// -// } -// -// public static Map getOnlineApplicationKeyValueWithId(String id) { -// try { -// return conf.getOnlineApplication(id); -// -// } catch (ConfigurationException e) { -// Logger.warn("OnlineApplication with Id: " + id + " not found.", e); -// return null; -// -// } -// } -// -// -// -// /** -// * -// * @return -// */ -// public static List getAllUsers() { -// Logger.trace("Get All Users from database."); -// -//// // select userdatabase from UserDatabase userdatabase -//// List result = conf.getList("getAllUsers", UserDatabase.class); -//// if (result.size() == 0) { -//// Logger.trace("No entries found."); -//// return null; -//// } -//// -//// return result; -// -// //TODO!!! -// return null; -// } -// -// /** -// * -// * @return -// */ -// public static List getAllOnlineApplications() { -// Logger.trace("Get All OnlineApplications from database."); -// -// // select onlineapplication from OnlineApplication onlineapplication -//// return conf.getList(MOAIDConfigurationConstants.ONLINE_APPLICATIONS_KEY, OnlineApplication.class); -// -// //TODO!!! -// return null; -// -// } -// -// /** -// * -// * @return -// */ -// public static List getAllNewOnlineApplications() { -// Logger.trace("Get All New OnlineApplications from database."); -// -// // select onlineapplication from OnlineApplication onlineapplication -// // where onlineapplication.isActive = '0' and onlineapplication.isAdminRequired = '1' -// List result = new ArrayList(); -// List allOAs = getAllOnlineApplications(); -// -// for (OnlineApplication oa : nullGuard(allOAs)) { -// if (!oa.isIsActive() && oa.isIsAdminRequired()) { -// result.add(oa); -// } -// } -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// -// return result; -// } -// -//// /** -//// * -//// * @return -//// */ -//// public static at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration getMOAIDConfiguration() { -//// Logger.trace("Load MOAID Configuration from database."); -//// -//// AuthComponentGeneral authComponent = (AuthComponentGeneral) conf.get(MOAIDConfigurationConstants.AUTH_COMPONENT_GENERAL_KEY, -//// AuthComponentGeneral.class); -//// -//// ChainingModes chainingModes = (ChainingModes) conf.get(MOAIDConfigurationConstants.CHAINING_MODES_KEY, ChainingModes.class); -//// List genericConfigurations = (List) conf.getList( -//// MOAIDConfigurationConstants.GENERIC_CONFIGURATION_KEY, GenericConfiguration.class); -//// String trustedCaCertificates = (String) conf.get(MOAIDConfigurationConstants.TRUSTED_CERTIFICATES_KEY, String.class); -//// DefaultBKUs defaultBKUs = (DefaultBKUs) conf.get(MOAIDConfigurationConstants.DEFAULT_BKUS_KEY, DefaultBKUs.class); -//// SLRequestTemplates slrRequestRemplates = (SLRequestTemplates) conf.get(MOAIDConfigurationConstants.SLREQUEST_TEMPLATES_KEY, -//// SLRequestTemplates.class); -//// Date timeStamp = (Date) conf.get(MOAIDConfigurationConstants.TIMESTAMP_ITEM_KEY, Date.class); -//// Date pvp2Refresh = (Date) conf.get(MOAIDConfigurationConstants.PVP2REFRESH_ITEM_KEY, Date.class); -//// -//// // if (authComponent == null || chainingModes == null || trustedCaCertificates == null || defaultBKUs == null -//// // || slrRequestRemplates == null || timeStamp == null || pvp2Refresh == null -//// // -//// // ) { -//// // // TODO: is there a better approach in case of error? -//// // Logger.trace("Not all necessary data available. Create fresh instance."); -//// // return new MOAIDConfiguration(); -//// // } -//// -//// // select moaidconfiguration from MOAIDConfiguration moaidconfiguration -//// at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration result = new at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration(); -//// result.setAuthComponentGeneral(authComponent); -//// result.setChainingModes(chainingModes); -//// result.setGenericConfiguration(genericConfigurations); -//// result.setTrustedCACertificates(trustedCaCertificates); -//// result.setDefaultBKUs(defaultBKUs); -//// result.setSLRequestTemplates(slrRequestRemplates); -//// result.setTimestampItem(timeStamp); -//// result.setPvp2RefreshItem(pvp2Refresh); -//// -//// return result; -//// } -// -// /** -// * -// * @return -// */ -// public static List getAllActiveOnlineApplications() { -// Logger.trace("Get All New OnlineApplications from database."); -// -// // select onlineapplication from OnlineApplication onlineapplication -// // where onlineapplication.isActive = '1' -// List result = new ArrayList(); -// List allOAs = getAllOnlineApplications(); -// -// for (OnlineApplication oa : nullGuard(allOAs)) { -// if (oa.isIsActive()) { -// result.add(oa); -// } -// } -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// -// return result; -// } -// -// /** -// * -// * @param id -// * @return -// */ -// public static OnlineApplication getActiveOnlineApplication(String id) { -// Logger.trace("Getting Active OnlineApplication with ID " + id + " from database."); -// -// // select onlineapplication from OnlineApplication onlineapplication -// // where onlineapplication.publicURLPrefix = -// // SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) and onlineapplication.isActive = '1' -// OnlineApplication result = null; -// List allActiveOAs = getAllActiveOnlineApplications(); -// -// for (OnlineApplication oa : nullGuard(allActiveOAs)) { -// String publicUrlPrefix = oa.getPublicURLPrefix(); -// if (publicUrlPrefix != null && publicUrlPrefix.length() <= id.length()) { -// if ((id.substring(1, publicUrlPrefix.length()).equals(publicUrlPrefix))) { -// if (result != null) { -// Logger.warn("OAIdentifier match to more then one DB-entry!"); -// return null; -// } else { -// result = oa; -// } -// } -// } -// } -// -// return result; -// } -// -// /** -// * -// * @param dbid -// * @return -// */ -// public static OnlineApplication getOnlineApplication(long dbid) { -// Logger.trace("Getting OnlineApplication with DBID " + dbid + " from database."); -// -// // select onlineapplication from OnlineApplication onlineapplication where onlineapplication.hjid = :id -// OnlineApplication result = null; -// List allOAs = getAllOnlineApplications(); -// -// for (OnlineApplication oa : nullGuard(allOAs)) { -// if (oa.getHjid() == dbid) { -// result = oa; -// break; -// } -// } -// -// return result; -// } -// -// /** -// * -// * @param id -// * @return -// */ -// public static OnlineApplication getOnlineApplication(String id) { -// Logger.trace("Getting OnlineApplication with ID " + id + " from database."); -// -// // select onlineapplication from OnlineApplication onlineapplication -// // where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) -// OnlineApplication result = null; -// List allOAs = getAllOnlineApplications(); -// -// for (OnlineApplication oa : nullGuard(allOAs)) { -// String publicUrlPrefix = oa.getPublicURLPrefix(); -// if (publicUrlPrefix != null && publicUrlPrefix.length() <= id.length()) { -// if (id.substring(1, publicUrlPrefix.length()).equals(publicUrlPrefix)) { -// if (result != null) { -// Logger.warn("OAIdentifier match to more then one DB-entry!"); -// return null; -// } else { -// result = oa; -// } -// } -// } -// } -// -// return result; -// } -// -// /** -// * -// * @param id -// * @return -// */ -// public static List searchOnlineApplications(String id) { -// Logger.trace("Getting OnlineApplication with ID " + id + " from database."); -// -// // select onlineapplication from OnlineApplication onlineapplication -// // where onlineapplication.friendlyName like :id -// List result = new ArrayList(); -// List allOAs = getAllOnlineApplications(); -// -// for (OnlineApplication oa : nullGuard(allOAs)) { -// if (id.equals(oa.getFriendlyName())) { -// result.add(oa); -// } -// } -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// -// return result; -// } -// -// /** -// * -// * @return -// */ -// public static List getAllOpenUsersRequests() { -// Logger.trace("Get all new Users from Database"); -// -// // select userdatabase from UserDatabase userdatabase -// // where userdatabase.userRequestTokken is not null -// // and userdatabase.isAdminRequest = '1' and userdatabase.isMailAddressVerified = '0' -// List result = new ArrayList(); -// List allUsers = getAllUsers(); -// -// for (UserDatabase user : nullGuard(allUsers)) { -// // TODO check result of query "... userdatabase.userRequestTokken is not null" if Tokken is null -> (null, "NULL", "", ... ?) -// if ((user.getUserRequestTokken() != null && !user.getUserRequestTokken().isEmpty() && !user.getUserRequestTokken().equals("NULL")) -// && (user.isIsAdminRequest()) && (!user.isIsMailAddressVerified())) { -// result.add(user); -// } -// } -// -// if (result.size() == 0) { -// Logger.trace("No entries found."); -// return null; -// } -// -// return result; -// } -// -// /** -// * -// * @param tokken -// * @return -// */ -// public static UserDatabase getNewUserWithTokken(String tokken) { -// Logger.trace("Getting Userinformation with Tokken " + tokken + " from database."); -// -// // select userdatabase from UserDatabase userdatabase where userdatabase.userRequestTokken = :tokken -// UserDatabase result = null; -// List allUsers = getAllUsers(); -// -// for (UserDatabase user : nullGuard(allUsers)) { -// if (user.getUserRequestTokken().equals(tokken)) { -// result = user; -// break; -// } -// } -// -// return result; -// } -// -// /** -// * -// * @param id -// * @return -// */ -// public static UserDatabase getUsersWithOADBID(long id) { -// Logger.trace("Getting Userinformation with OADBID " + id + " from database."); -// -// // select userdatabase from UserDatabase userdatabase -// // inner join userdatabase.onlineApplication oa where oa.hjid = :id -// UserDatabase result = null; -// List allUsers = getAllUsers(); -// -// boolean quit = false; -// for (UserDatabase user : nullGuard(allUsers)) { -// -// for (OnlineApplication oa : user.getOnlineApplication()) { -// -// if (oa.getHjid() == id) { -// result = user; -// quit = true; -// break; -// } -// } -// -// if (quit) { -// break; -// } -// } -// -// return result; -// } -// -// /** -// * -// * @param id -// * @return -// */ -// public static UserDatabase getUserWithID(long id) { -// Logger.trace("Getting Userinformation with ID " + id + " from database."); -// -// // select userdatabase from UserDatabase userdatabase where userdatabase.hjid = :id -// UserDatabase result = null; -// List allUsers = getAllUsers(); -// -// for (UserDatabase user : nullGuard(allUsers)) { -// if (user.getHjid() == id) { -// result = user; -// break; -// } -// } -// -// return result; -// } -// -// /** -// * -// * @param username -// * @return -// */ -// public static UserDatabase getUserWithUserName(String username) { -// Logger.trace("Getting Userinformation with ID " + username + " from database."); -// -// // select userdatabase from UserDatabase userdatabase where userdatabase.username = :username -// UserDatabase result = null; -// List allUsers = getAllUsers(); -// -// for (UserDatabase user : nullGuard(allUsers)) { -// if (user.getUsername().equals(username)) { -// result = user; -// break; -// } -// } -// -// return result; -// } -// -// /** -// * -// * @param bpkwbpk -// * @return -// */ -// public static UserDatabase getUserWithUserBPKWBPK(String bpkwbpk) { -// Logger.trace("Getting Userinformation with ID " + bpkwbpk + " from database."); -// -// // select userdatabase from UserDatabase userdatabase where userdatabase.bpk = :bpk -// UserDatabase result = null; -// List allUsers = getAllUsers(); -// -// for (UserDatabase user : nullGuard(allUsers)) { -// if (user.getBpk().equals(bpkwbpk)) { -// result = user; -// break; -// } -// } -// -// return result; -// } -// -//} +package at.gv.egovernment.moa.id.commons.db; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; + +import at.gv.egiz.components.configuration.api.ConfigurationException; +import at.gv.egovernment.moa.id.commons.config.ConfigurationMigrationUtils; +import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; +import at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration; +import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; + +import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; +import at.gv.egovernment.moa.id.commons.utils.KeyValueUtils; +import at.gv.egovernment.moa.logging.Logger; + +/** + * + * + */ +public class NewConfigurationDBRead { + + private MOAIDConfiguration conf; + + @Autowired(required = true) + public void setConfiguration(MOAIDConfiguration conf) { + // https://jira.spring.io/browse/SPR-3845 + this.conf = conf; + } + + @SuppressWarnings("unchecked") + public static > T nullGuard(T item) { + if (item == null) { + return (T) Collections.emptyList(); + } else { + return item; + } + + } + + public Map getOnlineApplicationKeyValueWithId(String id) { + try { + return conf.getOnlineApplication(id); + + } catch (ConfigurationException e) { + Logger.warn("OnlineApplication with Id: " + id + " not found.", e); + return null; + + } + } + + /** + * + * @return + */ + public List getAllOnlineApplications() { + Logger.trace("Get All OnlineApplications from database."); + + List result = new ArrayList(); + try { + String[] allUniqueOAIDs = conf.findConfigurationId(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES + ".*." + MOAIDConfigurationConstants.SERVICE_UNIQUEIDENTIFIER); + if (allUniqueOAIDs != null) { + for (String uniqueOAID : allUniqueOAIDs) { + String oaKeyId = KeyValueUtils.getParentKey(uniqueOAID); + + Logger.debug("Search service with KeyPrefix:" + oaKeyId); + Map oaKeyValuePairs = conf.getPropertySubset(oaKeyId, true); + + String serviceType = KeyValueUtils.getFirstChildAfterPrefix(oaKeyId, MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES); + Logger.debug("Identify Service as: " + serviceType); + + if (oaKeyValuePairs != null) { + Logger.debug("Transform Key/Value to JaxB configuration ..."); + oaKeyValuePairs.put(MOAIDConfigurationConstants.PREFIX_MOAID_SERVICES, serviceType); + OnlineApplication jaxBOA = ConfigurationMigrationUtils.convertKeyValueToHyberJaxBOnlineApplication(oaKeyValuePairs); + + String hjID = KeyValueUtils.getFirstChildAfterPrefix(oaKeyId, KeyValueUtils.getParentKey(oaKeyId)); + if (serviceType.equals(MOAIDConfigurationConstants.PREFIX_GATEWAY)) + jaxBOA.setHjid(Long.valueOf(hjID) + 1000000); + else if (serviceType.equals(MOAIDConfigurationConstants.PREFIX_IIDP)) + jaxBOA.setHjid(Long.valueOf(hjID) + 2000000); + else if (serviceType.equals(MOAIDConfigurationConstants.PREFIX_VIDP)) + jaxBOA.setHjid(Long.valueOf(hjID) + 3000000); + else + jaxBOA.setHjid(Long.valueOf(hjID)); + + Logger.debug("Transformation finished with JaxB hjID: " + hjID); + result.add(jaxBOA); + + } else + Logger.info("No Service configuration with KeyPrefix: " + oaKeyId); + } + } + if (!result.isEmpty()) + return result; + + } catch (ConfigurationException e) { + Logger.error("Access configuration FAILED.", e); + + } + + return null; + + } + + /** + * + * @return + */ + public List getAllNewOnlineApplications() { + Logger.trace("Get All New OnlineApplications from database."); + + // select onlineapplication from OnlineApplication onlineapplication + // where onlineapplication.isActive = '0' and onlineapplication.isAdminRequired = '1' + List result = new ArrayList(); + List allOAs = getAllOnlineApplications(); + + for (OnlineApplication oa : nullGuard(allOAs)) { + if (!oa.isIsActive() && oa.isIsAdminRequired()) { + result.add(oa); + } + } + + if (result.size() == 0) { + Logger.trace("No entries found."); + return null; + } + + return result; + } + + /** + * + * @return + */ + public at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOAIDConfiguration getMOAIDConfiguration() { + Logger.trace("Load MOAID Configuration from database."); + Map generalConfig; + try { + generalConfig = conf.getPropertySubset(MOAIDConfigurationConstants.PREFIX_MOAID_GENERAL, false); + if (generalConfig != null) { + Logger.debug("Key/Value configuration found -> Start mapping process ..."); + + at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.MOAIDConfiguration result = + ConfigurationMigrationUtils.convertKeyValueToHyberJaxBMOAIDConfiguration(generalConfig); + Logger.debug("Configuration mapping process finished."); + + return result; + + } + + } catch (ConfigurationException e) { + Logger.error("Configuration access FAILED!", e); + } + + Logger.info("No general MOA-ID configuration found!"); + return null; + + } + + /** + * + * @return + */ + public List getAllActiveOnlineApplications() { + Logger.trace("Get All New OnlineApplications from database."); + + // select onlineapplication from OnlineApplication onlineapplication + // where onlineapplication.isActive = '1' + List result = new ArrayList(); + List allOAs = getAllOnlineApplications(); + + for (OnlineApplication oa : nullGuard(allOAs)) { + if (oa.isIsActive()) { + result.add(oa); + } + } + + if (result.size() == 0) { + Logger.trace("No entries found."); + return null; + } + + return result; + } + + /** + * + * @param id + * @return + */ + public OnlineApplication getActiveOnlineApplication(String id) { + Logger.trace("Getting Active OnlineApplication with ID " + id + " from database."); + + // select onlineapplication from OnlineApplication onlineapplication + // where onlineapplication.publicURLPrefix = + // SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) and onlineapplication.isActive = '1' + OnlineApplication result = null; + List allActiveOAs = getAllActiveOnlineApplications(); + + for (OnlineApplication oa : nullGuard(allActiveOAs)) { + String publicUrlPrefix = oa.getPublicURLPrefix(); + if (publicUrlPrefix != null && publicUrlPrefix.length() <= id.length()) { + if ((id.substring(1, publicUrlPrefix.length()).equals(publicUrlPrefix))) { + if (result != null) { + Logger.warn("OAIdentifier match to more then one DB-entry!"); + return null; + } else { + result = oa; + } + } + } + } + + return result; + } + + /** + * + * @param dbid + * @return + */ + public OnlineApplication getOnlineApplication(long dbid) { + Logger.trace("Getting OnlineApplication with DBID " + dbid + " from database."); + + // select onlineapplication from OnlineApplication onlineapplication where onlineapplication.hjid = :id + OnlineApplication result = null; + List allOAs = getAllOnlineApplications(); + + for (OnlineApplication oa : nullGuard(allOAs)) { + if (oa.getHjid() == dbid) { + result = oa; + break; + } + } + + return result; + } + + /** + * + * @param id + * @return + */ + public OnlineApplication getOnlineApplication(String id) { + Logger.trace("Getting OnlineApplication with ID " + id + " from database."); + + // select onlineapplication from OnlineApplication onlineapplication + // where onlineapplication.publicURLPrefix = SUBSTRING(:id, 1, LENGTH(onlineapplication.publicURLPrefix)) + OnlineApplication result = null; + List allOAs = getAllOnlineApplications(); + + for (OnlineApplication oa : nullGuard(allOAs)) { + String publicUrlPrefix = oa.getPublicURLPrefix(); + if (publicUrlPrefix != null && publicUrlPrefix.length() <= id.length()) { + if (id.substring(0, publicUrlPrefix.length()).equals(publicUrlPrefix)) { + if (result != null) { + Logger.warn("OAIdentifier match to more then one DB-entry!"); + return null; + } else { + result = oa; + } + } + } + } + + return result; + } + + /** + * + * @param id + * @return + */ + public List searchOnlineApplications(String id) { + Logger.trace("Getting OnlineApplication with ID " + id + " from database."); + + // select onlineapplication from OnlineApplication onlineapplication + // where onlineapplication.friendlyName like :id + List result = new ArrayList(); + List allOAs = getAllOnlineApplications(); + + for (OnlineApplication oa : nullGuard(allOAs)) { + if (oa.getFriendlyName().contains(id)) { + result.add(oa); + } + } + + if (result.size() == 0) { + Logger.trace("No entries found."); + return null; + } + + return result; + } + + +} diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBWrite.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBWrite.java index a2b1f120e..ccc7f33f1 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBWrite.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/NewConfigurationDBWrite.java @@ -8,13 +8,14 @@ // //import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; //import at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration; -//import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral; -//import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModes; -//import at.gv.egovernment.moa.id.commons.db.dao.config.DefaultBKUs; -//import at.gv.egovernment.moa.id.commons.db.dao.config.GenericConfiguration; -//import at.gv.egovernment.moa.id.commons.db.dao.config.OnlineApplication; -//import at.gv.egovernment.moa.id.commons.db.dao.config.SLRequestTemplates; +//import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.AuthComponentGeneral; +//import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.ChainingModes; +//import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.DefaultBKUs; +//import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.GenericConfiguration; +//import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.OnlineApplication; +//import at.gv.egovernment.moa.id.commons.db.dao.config.deprecated.SLRequestTemplates; //import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase; +//import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; // ///** // * This class is used for writing to the key-value database. @@ -30,108 +31,22 @@ // NewConfigurationDBWrite.conf = conf; // } // -// private static boolean saveAuthComponentGeneral(AuthComponentGeneral dbo) { -// return conf.set(MOAIDConfigurationConstants.AUTH_COMPONENT_GENERAL_KEY, dbo); -// } -// -// private static boolean saveChainingModes(ChainingModes dbo) { -// return conf.set(MOAIDConfigurationConstants.CHAINING_MODES_KEY, dbo); -// } -// -// private static boolean saveOnlineApplication(OnlineApplication dbo) { -// -// List storedObjects = conf.getList(MOAIDConfigurationConstants.ONLINE_APPLICATIONS_KEY, OnlineApplication.class); -// storedObjects.add(dbo); -// return conf.set(MOAIDConfigurationConstants.ONLINE_APPLICATIONS_KEY, storedObjects); -// } -// -// private static boolean saveGenericConfiguration(GenericConfiguration dbo) { -// -// List storedObjects = conf.getList(MOAIDConfigurationConstants.GENERIC_CONFIGURATION_KEY, GenericConfiguration.class); -// storedObjects.add(dbo); -// return conf.set(MOAIDConfigurationConstants.GENERIC_CONFIGURATION_KEY, storedObjects); -// } -// -// private static boolean saveTrustedCACertificates(String dbo) { -// return conf.set(MOAIDConfigurationConstants.TRUSTED_CERTIFICATES_KEY, dbo); -// } -// -// private static boolean saveDefaultBKUs(DefaultBKUs dbo) { -// return conf.set(MOAIDConfigurationConstants.DEFAULT_BKUS_KEY, dbo); -// } -// -// private static boolean saveSLRequestTemplates(SLRequestTemplates dbo) { -// return conf.set(MOAIDConfigurationConstants.SLREQUEST_TEMPLATES_KEY, dbo); -// } -// -// private static boolean saveTimeStampItem(Date dbo) { -// return conf.set(MOAIDConfigurationConstants.TIMESTAMP_ITEM_KEY, dbo); -// } -// -// private static boolean savePvp2RefreshItem(Date dbo) { -// return conf.set(MOAIDConfigurationConstants.PVP2REFRESH_ITEM_KEY, dbo); -// } -// -// /** -// * Saves the given list of {@link OnlineApplication} objects to database. -// * @param oas the list -// * @return {@code true} on success; {@code false} otherwise. -// */ -// public static boolean saveOnlineApplications(List oas) { -// return conf.set(MOAIDConfigurationConstants.ONLINE_APPLICATIONS_KEY, oas); -// } -// -// /** -// * Saves the given list of {@link GenericConfiguration} objects to database. -// * @param gcs the list -// * @return {@code true} on success; {@code false} otherwise. -// */ -// public static boolean saveGenericConfigurations(List gcs) { -// return conf.set(MOAIDConfigurationConstants.GENERIC_CONFIGURATION_KEY, gcs); -// } -// -// +// +// // /** -// * Saves the given object to database -// * @param dbo the object to save -// * @return {@code true} on success; {@code false} otherwise. +// * @param user // */ -// public static boolean save(Object dbo) { -// -// boolean result = false; -// -// if (dbo instanceof OnlineApplication) { -// -// result = saveOnlineApplication((OnlineApplication) dbo); -// -// } else if (dbo instanceof MOAIDConfiguration) { -// -// at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration moaconfig = -// (at.gv.egovernment.moa.id.commons.db.dao.config.MOAIDConfiguration) dbo; -// result = true; -// -// result &= saveAuthComponentGeneral(moaconfig.getAuthComponentGeneral()); -// result &= saveChainingModes(moaconfig.getChainingModes()); -// result &= saveDefaultBKUs(moaconfig.getDefaultBKUs()); -// result &= saveGenericConfigurations(moaconfig.getGenericConfiguration()); -// result &= savePvp2RefreshItem(moaconfig.getPvp2RefreshItem()); -// result &= saveSLRequestTemplates(moaconfig.getSLRequestTemplates()); -// result &= saveTrustedCACertificates(moaconfig.getTrustedCACertificates()); -// result &= saveTimeStampItem(moaconfig.getTimestampItem()); -// -// } else if (dbo instanceof UserDatabase) { -// // TODO implement user handling -// } -// -// return result; +// public void saveOrUpdate(UserDatabase user) throws MOADatabaseException{ +// // TODO Auto-generated method stub +// // } // // /** -// * Deletes the object associated with the given key. -// * @param key the key +// * @param dbuser // */ -// public static void delete(String key) { -// conf.set(key, null); +// public void delete(UserDatabase dbuser) { +// // TODO Auto-generated method stub +// // } // //} diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/MOAIDConfiguration.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/MOAIDConfiguration.java index 4807a81b3..696d7ac6d 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/MOAIDConfiguration.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/MOAIDConfiguration.java @@ -190,7 +190,25 @@ public class MOAIDConfiguration @XmlAttribute(name = "Hjid") protected Long hjid; + protected String eventCodes = null; + + + /** + * @return the eventCodes + */ + public String getEventCodes() { + return eventCodes; + } + + /** + * @param eventCodes the eventCodes to set + */ + public void setEventCodes(String eventCodes) { + this.eventCodes = eventCodes; + } + + /** * Gets the value of the authComponentGeneral property. * * @return diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java index 1beb8868e..79cdcacf5 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/OnlineApplication.java @@ -100,7 +100,39 @@ public class OnlineApplication @XmlSchemaType(name = "boolean") protected Boolean removeBPKFromAuthBlock; + protected Boolean isRevisionsLogActive = false; + protected String eventCodes = null; + + /** + * @return the isRevisionsLogActive + */ + public Boolean getIsRevisionsLogActive() { + return isRevisionsLogActive; + } + + /** + * @param isRevisionsLogActive the isRevisionsLogActive to set + */ + public void setIsRevisionsLogActive(Boolean isRevisionsLogActive) { + this.isRevisionsLogActive = isRevisionsLogActive; + } + + /** + * @return the eventCodes + */ + public String getEventCodes() { + return eventCodes; + } + + /** + * @param eventCodes the eventCodes to set + */ + public void setEventCodes(String eventCodes) { + this.eventCodes = eventCodes; + } + + /** * Gets the value of the publicURLPrefix property. * * @return diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/ValidationHelper.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/ValidationHelper.java index 13d680b78..01ae2a354 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/ValidationHelper.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/validation/ValidationHelper.java @@ -143,7 +143,7 @@ public class ValidationHelper { long oaID = Long.valueOf(oaIDObj); - if (oaID > 0 && oaID < Long.MAX_VALUE) + if (oaID >= 0 && oaID < Long.MAX_VALUE) return true; } catch (Throwable t) { diff --git a/id/server/moa-id-commons/src/main/resources/META-INF/persistence.xml b/id/server/moa-id-commons/src/main/resources/META-INF/persistence.xml index 1f7efd589..9bebfa66f 100644 --- a/id/server/moa-id-commons/src/main/resources/META-INF/persistence.xml +++ b/id/server/moa-id-commons/src/main/resources/META-INF/persistence.xml @@ -8,6 +8,7 @@ http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" org.hibernate.ejb.HibernatePersistence at.gv.egovernment.moa.id.commons.db.dao.config.ConfigProperty + -- cgit v1.2.3