Implemented loading VC from gz files & updated OAuth2 expiry check.

Change-Id: I01c607b86b992526400a3df9c5a66fa6211f4ac8
diff --git a/full/src/main/resources/db/insert/V3.5__insert_oauth2_clients.sql b/full/src/main/resources/db/insert/V3.5__insert_oauth2_clients.sql
index 68bbfa7..0d518a3 100644
--- a/full/src/main/resources/db/insert/V3.5__insert_oauth2_clients.sql
+++ b/full/src/main/resources/db/insert/V3.5__insert_oauth2_clients.sql
@@ -47,6 +47,7 @@
 --  "https://korap.ids-mannheim.de/public/redirect","system", 
 --  "This is a test super public client."); 
 
-INSERT INTO oauth2_access_token(token,user_id,created_date, user_auth_time)
-VALUES("fia0123ikBWn931470H8s5gRqx7Moc4p","marlin","2018-05-30 16:25:50",
-"2018-05-30 16:23:10");
\ No newline at end of file
+INSERT INTO oauth2_access_token(token,user_id,created_date, 
+expiry_date, refresh_expiry_date, user_auth_time)
+VALUES("fia0123ikBWn931470H8s5gRqx7Moc4p","marlin","2018-05-30 16:25:50", 
+"2018-05-31 16:25:50", "2018-08-30 16:25:50", "2018-05-30 16:23:10");
diff --git a/full/src/main/resources/db/new-mysql/V1.4__oauth2_tables.sql b/full/src/main/resources/db/new-mysql/V1.4__oauth2_tables.sql
index 4c35fca..10e069d 100644
--- a/full/src/main/resources/db/new-mysql/V1.4__oauth2_tables.sql
+++ b/full/src/main/resources/db/new-mysql/V1.4__oauth2_tables.sql
@@ -11,7 +11,7 @@
 	name VARCHAR(200) NOT NULL,
 	secret VARCHAR(200) DEFAULT NULL,
 	type VARCHAR(200) NOT NULL,
-	native BOOLEAN DEFAULT FALSE,
+	super BOOLEAN DEFAULT FALSE,
 	redirect_uri TEXT DEFAULT NULL,
 	description VARCHAR(250) NOT NULL,
 	registered_by VARCHAR(100) NOT NULL,
@@ -27,6 +27,7 @@
 	user_id VARCHAR(100) NOT NULL,
 	redirect_uri TEXT DEFAULT NULL,
 	created_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+	expiry_date TIMESTAMP NULL,
 	is_revoked BOOLEAN DEFAULT 0,
 	total_attempts INTEGER DEFAULT 0,
 	user_auth_time TIMESTAMP NULL,
@@ -57,9 +58,11 @@
 	user_id VARCHAR(100) DEFAULT NULL,
 	client_id VARCHAR(100) DEFAULT NULL,
 	created_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+	expiry_date TIMESTAMP NULL,
 	is_revoked BOOLEAN DEFAULT 0,
 	user_auth_time TIMESTAMP NULL,
     refresh_token VARCHAR(255) DEFAULT NULL,
+    refresh_expiry_date TIMESTAMP NULL,
 	is_refresh_revoked BOOLEAN DEFAULT 0,
 	FOREIGN KEY (client_id)
 	   REFERENCES oauth2_client(id)
diff --git a/full/src/main/resources/db/new-sqlite/V1.4__oauth2_tables.sql b/full/src/main/resources/db/new-sqlite/V1.4__oauth2_tables.sql
index 47f0a0f..45fa1f4 100644
--- a/full/src/main/resources/db/new-sqlite/V1.4__oauth2_tables.sql
+++ b/full/src/main/resources/db/new-sqlite/V1.4__oauth2_tables.sql
@@ -28,7 +28,8 @@
 	client_id VARCHAR(100) NOT NULL,
 	user_id VARCHAR(100) NOT NULL,
 	redirect_uri TEXT DEFAULT NULL,
-	created_date TIMESTAMP DEFAULT (datetime('now','localtime')),
+	created_date TIMESTAMP NOT NULL,
+	expiry_date TIMESTAMP NOT NULL,
 	is_revoked BOOLEAN DEFAULT 0,
 	total_attempts INTEGER DEFAULT 0,
 	user_auth_time TIMESTAMP NOT NULL,
@@ -61,10 +62,12 @@
 	token VARCHAR(255) NOT NULL,
 	user_id VARCHAR(100) DEFAULT NULL,
 	client_id VARCHAR(100) DEFAULT NULL,
-	created_date TIMESTAMP DEFAULT (datetime('now','localtime')),
+	created_date TIMESTAMP NOT NULL,
+	expiry_date TIMESTAMP NOT NULL,
 	is_revoked BOOLEAN DEFAULT 0,
 	user_auth_time TIMESTAMP NOT NULL,
 	refresh_token VARCHAR(255) DEFAULT NULL,
+	refresh_expiry_date TIMESTAMP NOT NULL,
 	is_refresh_revoked BOOLEAN DEFAULT 0,
 	FOREIGN KEY (client_id)
 	   REFERENCES oauth2_client(id)
diff --git a/full/src/main/resources/db/new-sqlite/V1.5__oauth2_triggers.sql b/full/src/main/resources/db/new-sqlite/V1.5__oauth2_triggers.sql
index d62e4df..96329af 100644
--- a/full/src/main/resources/db/new-sqlite/V1.5__oauth2_triggers.sql
+++ b/full/src/main/resources/db/new-sqlite/V1.5__oauth2_triggers.sql
@@ -1,14 +1,15 @@
-CREATE TRIGGER insert_authorization_date AFTER INSERT ON oauth2_authorization
-     BEGIN
-      UPDATE oauth2_authorization
-      SET created_date = DATETIME('now', 'localtime')  
-      WHERE rowid = new.rowid;
-     END;
-
-CREATE TRIGGER insert_access_token_date AFTER INSERT ON oauth2_access_token
-     BEGIN
-      UPDATE oauth2_access_token
-      SET created_date = DATETIME('now', 'localtime')  
-      WHERE rowid = new.rowid;
-     END;
+--CREATE TRIGGER insert_authorization_date AFTER INSERT ON oauth2_authorization
+--     BEGIN
+--      UPDATE oauth2_authorization
+--      SET created_date = DATETIME('now', 'localtime')  
+--      WHERE rowid = new.rowid;
+--     END;
+--     
+--
+--CREATE TRIGGER insert_access_token_date AFTER INSERT ON oauth2_access_token
+--     BEGIN
+--      UPDATE oauth2_access_token
+--      SET created_date = DATETIME('now', 'localtime')  
+--      WHERE rowid = new.rowid;
+--     END;
      
\ No newline at end of file