[DEV] some correction in migartion that does not work

This commit is contained in:
Edouard DUPIN 2023-08-13 19:28:25 +02:00
parent 144190fc4b
commit 293d80efd7
6 changed files with 22 additions and 18 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="out/maven/classes" path="src">
<classpathentry including="**/*.java" kind="src" output="out/maven/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
@ -13,7 +13,7 @@
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>kangaroo-and-rabbit</groupId>
<artifactId>archidata</artifactId>
<version>0.3.7</version>
<version>0.3.8</version>
<properties>
<jersey.version>3.1.1</jersey.version>
<jaxb.version>2.3.1</jaxb.version>

View File

@ -201,7 +201,7 @@ public class AuthenticationFilter implements ContainerRequestFilter {
}
// must be override to be good implementation
protected UserByToken validateJwtToken(String authorization) throws Exception {
logger.debug(" validate token : " + authorization);
//logger.debug(" validate token : " + authorization);
JWTClaimsSet ret = JWTWrapper.validateToken(authorization, "KarAuth", null);
// check the token is valid !!! (signed and coherent issuer...
if (ret == null) {
@ -224,7 +224,7 @@ public class AuthenticationFilter implements ContainerRequestFilter {
logger.error("Connect with no right for this application='{}' full Right='{}'", this.applicationName, rights);
}
}
logger.debug("request user: '{}' right: '{}' row='{}'", userUID, user.right, rowRight);
//logger.debug("request user: '{}' right: '{}' row='{}'", userUID, user.right, rowRight);
return user;
//return UserDB.getUserOrCreate(id, (String)ret.getClaim("login") );
}

View File

@ -39,7 +39,7 @@ public class MigrationEngine {
* @param migration Migration to add.
*/
public void add(MigrationInterface migration) {
datas.add(migration);
this.datas.add(migration);
}
/**
* Set first initialization class
@ -68,7 +68,7 @@ public class MigrationEngine {
}
LOGGER.debug("List of migrations:");
for (MigrationModel elem : data) {
LOGGER.debug(" - date={} name={} end{}", elem.modify_date, elem.name, elem.terminated);
LOGGER.debug(" - date={} name={} end={}", elem.modify_date, elem.name, elem.terminated);
}
return data.get(data.size()-1);
} catch (Exception ex) {
@ -163,16 +163,20 @@ public class MigrationEngine {
Thread.sleep(60*60*1000);
}
}
LOGGER.info("Upgrade the system Current version: {}", currentVersion);
LOGGER.info("Upgrade the system Current version: {}", currentVersion.name);
boolean find = this.init != null && this.init.getName() == currentVersion.name;
for (int iii=0; iii<this.datas.size(); iii++) {
if ( ! find) {
if (this.datas.get(iii).getName() == currentVersion.name) {
find = true;
if (currentVersion.name.equals(this.init.getName())) {
toApply = this.datas;
} else {
for (int iii=0; iii<this.datas.size(); iii++) {
if ( ! find) {
if (this.datas.get(iii).getName() == currentVersion.name) {
find = true;
}
continue;
}
continue;
toApply.add(this.datas.get(iii));
}
toApply.add(this.datas.get(iii));
}
}
DBEntry entry = DBEntry.createInterface(config);

View File

@ -10,7 +10,7 @@ import org.kar.archidata.db.DBEntry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MigrationSqlStep implements MigrationInterface{
public class MigrationSqlStep implements MigrationInterface {
final static Logger LOGGER = LoggerFactory.getLogger(MigrationSqlStep.class);
private List<String> actions = new ArrayList<>();

View File

@ -45,7 +45,7 @@ public class JWTWrapper {
public static void initLocalTokenRemote(String ssoUri, String application) throws IOException, ParseException {
// check Token:
URL obj = new URL(ssoUri + "public_key");
logger.debug("Request token from: {}", obj);
//logger.debug("Request token from: {}", obj);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("User-Agent", application);
@ -58,7 +58,7 @@ public class JWTWrapper {
}
int responseCode = con.getResponseCode();
logger.debug("GET Response Code :: {}", responseCode);
//logger.debug("GET Response Code :: {}", responseCode);
if (responseCode == HttpURLConnection.HTTP_OK) { // success
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
@ -75,7 +75,7 @@ public class JWTWrapper {
rsaPublicJWK = RSAKey.parse(values.key);
return;
}
logger.debug("GET JWT validator token not worked");
logger.debug("GET JWT validator token not worked response code {} from {} ", responseCode, obj);
}
public static void initLocalToken(String baseUUID) throws Exception{