Commit c9c94d14 authored by Robert Butora's avatar Robert Butora
Browse files

docker: adds AuthDB support

parent 002d7142
Loading
Loading
Loading
Loading
+104 −4
Original line number Diff line number Diff line
@@ -68,11 +68,11 @@
                  <version>0.9.5</version>
          </dependency>

          <dependency>
          <!-- dependency>
                  <groupId>auth</groupId>
                  <artifactId>vlkb-auth</artifactId>
                  <version>0.1-SNAPSHOT</version>
          </dependency>
          </dependency -->

          <!-- needed in Regrid for merge -->
          <dependency>
@@ -81,8 +81,6 @@
                  <version>1.0</version>
          </dependency>



          <dependency>
                  <groupId>com.googlecode.json-simple</groupId>
                  <artifactId>json-simple</artifactId>
@@ -96,6 +94,108 @@
                  <scope>test</scope>
          </dependency>


          <!-- auth dependencies (mostly caused by jjwt lib) -->

          <!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-jackson -->
          <dependency>
                  <groupId>io.jsonwebtoken</groupId>
                  <artifactId>jjwt-jackson</artifactId>
                  <version>0.12.3</version>
                  <scope>runtime</scope>
          </dependency>
          <!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-api -->
          <dependency>
                  <groupId>io.jsonwebtoken</groupId>
                  <artifactId>jjwt-api</artifactId>
                  <version>0.12.3</version>
          </dependency>
          <!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-api -->
          <dependency>
                  <groupId>io.jsonwebtoken</groupId>
                  <artifactId>jjwt-impl</artifactId>
                  <version>0.12.3</version>
          </dependency>

          <dependency>
                  <groupId>com.fasterxml.jackson.core</groupId>
                  <artifactId>jackson-core</artifactId>
                  <version>2.9.10</version>
          </dependency>
          <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
          <dependency>
                  <groupId>com.fasterxml.jackson.core</groupId>
                  <artifactId>jackson-annotations</artifactId>
                  <version>2.9.10</version>
          </dependency>
          <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
          <dependency>
                  <groupId>com.fasterxml.jackson.core</groupId>
                  <artifactId>jackson-databind</artifactId>
                  <version>2.9.10</version>
          </dependency>
          <!-- https://mvnrepository.com/artifact/jakarta.xml.bind/jakarta.xml.bind-api -->
          <dependency>
                  <groupId>jakarta.xml.bind</groupId>
                  <artifactId>jakarta.xml.bind-api</artifactId>
                  <version>2.3.2</version>
          </dependency>

          <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
          <dependency>
                  <groupId>org.slf4j</groupId>
                  <artifactId>slf4j-api</artifactId>
                  <version>1.7.36</version>
          </dependency>
          <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
          <dependency>
                  <groupId>org.slf4j</groupId>
                  <artifactId>slf4j-simple</artifactId>
                  <version>1.7.36</version>
                  <scope>test</scope>
          </dependency>
 
          <!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
          <!-- dependency>
                  <groupId>ch.qos.logback</groupId>
                  <artifactId>logback-classic</artifactId>
                  <version>1.4.7</version>
                  <scope>test</scope>
          </dependency -->
          <!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-core -->
          <!-- dependency>
                  <groupId>ch.qos.logback</groupId>
                  <artifactId>logback-core</artifactId>
                  <version>1.4.7</version>
          </dependency -->

          <!-- https://mvnrepository.com/artifact/org.cache2k/cache2k-api -->
          <dependency>
                  <groupId>org.cache2k</groupId>
                  <artifactId>cache2k-api</artifactId>
                  <version>1.2.4.Final</version>
          </dependency>
          <!-- https://mvnrepository.com/artifact/org.cache2k/cache2k-core -->
          <dependency>
                  <groupId>org.cache2k</groupId>
                  <artifactId>cache2k-core</artifactId>
                  <version>1.2.4.Final</version>
          </dependency>

          <!-- IA2 local -->
          <dependency>
                  <groupId>auth</groupId>
                  <artifactId>auth-lib</artifactId>
                  <version>2.0.0-SNAPSHOT</version>
          </dependency>
          <dependency>
                  <groupId>auth</groupId>
                  <artifactId>rap-client</artifactId>
                  <version>1.0-SNAPSHOT</version>
          </dependency>



  </dependencies>


+17 −9
Original line number Diff line number Diff line
@@ -32,8 +32,8 @@ public class AuthPolicyDb
   private static final Logger LOGGER = Logger.getLogger(AuthPolicyDb.class.getName());

   private static final String DB_DRIVER = "org.postgresql.Driver";
   //private static final Settings settings = Settings.getInstance();
   //static public Settings.DBConn dbconn = settings.dbConn;
   private static final Settings settings = Settings.getInstance();
   static public Settings.DBConn dbconn = settings.dbConn;
   static public String dbConnUrl;
   static public String dbUserName;
   static public String dbPassword;
@@ -184,7 +184,7 @@ public class AuthPolicyDb
         DriverManager.registerDriver(new org.postgresql.Driver());
         */

      LOGGER.finest(getRegisteredDriverList());
      //LOGGER.finest(getRegisteredDriverList());

      // FIXME seems DriverManager expects jdbc:postgresql driver scheme, it does not support postgresql:// scheme
      // additionally:
@@ -209,17 +209,25 @@ public class AuthPolicyDb
                 String password = userInfo[1];

                 String dbConnJdbcUrl = "jdbc:" + dbConnUrl.replace(userInfoString + "@", "");
                 */       LOGGER.finest("DBMS URL: " + dbConnUrl);
      LOGGER.finest("DBMS userName: " + dbUserName);
      LOGGER.finest("DBMS password: " + dbPassword);
   //              */       LOGGER.finest("DBMS URL: " + dbConnUrl);
   //   LOGGER.finest("DBMS userName: " + dbUserName);
   //   LOGGER.finest("DBMS password: " + dbPassword);

      conn = DriverManager.getConnection(dbConnUrl, dbUserName, dbPassword);
   //   conn = DriverManager.getConnection(dbConnUrl, dbUserName, dbPassword);

      st = conn.createStatement();
    //  st = conn.createStatement();

      // } catch (Exception e){ e.printStackTrace();}

      return st.executeQuery(TheQuery);
      // new
      LOGGER.finer("Connecting to: " + dbconn.uri() + " with optional user/pwd: " + dbconn.userName() + " / " + dbconn.password() );

            Connection conn = DriverManager.getConnection(dbconn.uri(), dbconn.userName(), dbconn.password());
            Statement  st   = conn.createStatement();
            ResultSet  res  = st.executeQuery(TheQuery);
         return res;
      // new end
      // return st.executeQuery(TheQuery);
   }


Loading