Changed the SQL script updating oauth2_client table.
Change-Id: Ieafc953f892ca69ceb27719bb8155c582b4a9733
diff --git a/full/Changes b/full/Changes
index 3bf608d..c53c97a 100644
--- a/full/Changes
+++ b/full/Changes
@@ -1,3 +1,6 @@
+2022-05-11
+ - Changed the SQL script updating oauth2_client table
+
# version 0.66
2022-03-31
@@ -16,7 +19,6 @@
- Updated authorization error response. (Included error and error
description in the client redirect URI except for missing or
invalid client id or redirect URI.
-
# version 0.65.2
diff --git a/full/src/main/resources/db/sqlite/V1.11__oauth2_client_alteration.sql b/full/src/main/resources/db/sqlite/V1.11__oauth2_client_alteration.sql
new file mode 100644
index 0000000..7bcde43
--- /dev/null
+++ b/full/src/main/resources/db/sqlite/V1.11__oauth2_client_alteration.sql
@@ -0,0 +1,25 @@
+CREATE TABLE IF NOT EXISTS oauth2_client_new (
+ id VARCHAR(100) PRIMARY KEY NOT NULL,
+ name VARCHAR(100) NOT NULL,
+ secret VARCHAR(255) DEFAULT NULL,
+ type VARCHAR(50) NOT NULL,
+ super BOOLEAN DEFAULT FALSE,
+ redirect_uri TEXT DEFAULT NULL,
+ description VARCHAR(255) NOT NULL,
+ registered_by VARCHAR(100) NOT NULL,
+ --url_hashcode INTEGER,
+ url TEXT DEFAULT NULL,
+ registration_date TIMESTAMP,
+ refresh_token_expiry INTEGER DEFAULT 31536000,
+ source BLOB DEFAULT NULL,
+ is_permitted BOOLEAN DEFAULT FALSE
+);
+
+INSERT INTO oauth2_client_new(id,name,secret,type,super,redirect_uri,description,registered_by,url)
+ SELECT id,name,secret,type,super,redirect_uri,description,registered_by,url FROM oauth2_client;
+
+UPDATE oauth2_client_new SET registration_date = CURRENT_TIMESTAMP;
+
+DROP TABLE oauth2_client;
+
+ALTER TABLE oauth2_client_new RENAME TO oauth2_client;
\ No newline at end of file
diff --git a/full/src/main/resources/db/sqlite/V1.11__plugin.sql b/full/src/main/resources/db/sqlite/V1.11__plugin.sql
deleted file mode 100644
index 94b90ca..0000000
--- a/full/src/main/resources/db/sqlite/V1.11__plugin.sql
+++ /dev/null
@@ -1,22 +0,0 @@
-ALTER TABLE oauth2_client
- ADD COLUMN registration_date TIMESTAMP NOT NULL;
-
--- default 365 days in seconds
-ALTER TABLE oauth2_client
- ADD COLUMN refresh_token_expiry INTEGER DEFAULT 31536000;
-
-ALTER TABLE oauth2_client
- ADD COLUMN source BLOB DEFAULT NULL;
-
-ALTER TABLE oauth2_client
- ADD COLUMN is_permitted BOOLEAN DEFAULT FALSE;
-
---CREATE TABLE IF NOT EXISTS user_installed_client (
--- id INTEGER PRIMARY KEY AUTOINCREMENT,
--- installed_by VARCHAR(100) NOT NULL,
--- installed_date TIMESTAMP NOT NULL,
--- client_id VARCHAR(100) NOT NULL,
--- FOREIGN KEY (client_id)
--- REFERENCES oauth2_client(id)
--- ON DELETE CASCADE
---);
\ No newline at end of file
diff --git a/full/src/test/java/de/ids_mannheim/korap/server/EmbeddedLdapServerTest.java b/full/src/test/java/de/ids_mannheim/korap/server/EmbeddedLdapServerTest.java
index 9e9700e..b669ade 100644
--- a/full/src/test/java/de/ids_mannheim/korap/server/EmbeddedLdapServerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/server/EmbeddedLdapServerTest.java
@@ -60,7 +60,7 @@
byte[] hash = f.generateSecret(spec).getEncoded();
final String pbkdf2sha256Password = "{PBKDF2-SHA256}" + Base64.encode(hash);
- System.out.println(pbkdf2sha256Password);
+// System.out.println(pbkdf2sha256Password);
assertEquals(LDAP_AUTH_ROK, LdapAuth3.login("user5", pbkdf2sha256Password, TEST_EMBEDDED_LDAP_CONF));
}
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ControllerTest.java b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ControllerTest.java
index a7d108c..87a3ab2 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ControllerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/controller/OAuth2ControllerTest.java
@@ -145,7 +145,7 @@
"unknown-client-id", "", "", "", userAuthHeader);
// assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
String entity = response.getEntity(String.class);
- System.out.println(entity);
+// System.out.println(entity);
JsonNode node = JsonUtils.readTree(entity);
assertEquals("Unknown client with unknown-client-id.",
node.at("/error_description").asText());