[DEV] some correction in migartion that does not work
This commit is contained in:
parent
144190fc4b
commit
293d80efd7
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="out/maven/classes" path="src">
|
<classpathentry including="**/*.java" kind="src" output="out/maven/classes" path="src">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<attribute name="test" value="true"/>
|
<attribute name="test" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</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>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>kangaroo-and-rabbit</groupId>
|
<groupId>kangaroo-and-rabbit</groupId>
|
||||||
<artifactId>archidata</artifactId>
|
<artifactId>archidata</artifactId>
|
||||||
<version>0.3.7</version>
|
<version>0.3.8</version>
|
||||||
<properties>
|
<properties>
|
||||||
<jersey.version>3.1.1</jersey.version>
|
<jersey.version>3.1.1</jersey.version>
|
||||||
<jaxb.version>2.3.1</jaxb.version>
|
<jaxb.version>2.3.1</jaxb.version>
|
||||||
|
@ -201,7 +201,7 @@ public class AuthenticationFilter implements ContainerRequestFilter {
|
|||||||
}
|
}
|
||||||
// must be override to be good implementation
|
// must be override to be good implementation
|
||||||
protected UserByToken validateJwtToken(String authorization) throws Exception {
|
protected UserByToken validateJwtToken(String authorization) throws Exception {
|
||||||
logger.debug(" validate token : " + authorization);
|
//logger.debug(" validate token : " + authorization);
|
||||||
JWTClaimsSet ret = JWTWrapper.validateToken(authorization, "KarAuth", null);
|
JWTClaimsSet ret = JWTWrapper.validateToken(authorization, "KarAuth", null);
|
||||||
// check the token is valid !!! (signed and coherent issuer...
|
// check the token is valid !!! (signed and coherent issuer...
|
||||||
if (ret == null) {
|
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.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 user;
|
||||||
//return UserDB.getUserOrCreate(id, (String)ret.getClaim("login") );
|
//return UserDB.getUserOrCreate(id, (String)ret.getClaim("login") );
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ public class MigrationEngine {
|
|||||||
* @param migration Migration to add.
|
* @param migration Migration to add.
|
||||||
*/
|
*/
|
||||||
public void add(MigrationInterface migration) {
|
public void add(MigrationInterface migration) {
|
||||||
datas.add(migration);
|
this.datas.add(migration);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Set first initialization class
|
* Set first initialization class
|
||||||
@ -68,7 +68,7 @@ public class MigrationEngine {
|
|||||||
}
|
}
|
||||||
LOGGER.debug("List of migrations:");
|
LOGGER.debug("List of migrations:");
|
||||||
for (MigrationModel elem : data) {
|
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);
|
return data.get(data.size()-1);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
@ -163,8 +163,11 @@ public class MigrationEngine {
|
|||||||
Thread.sleep(60*60*1000);
|
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;
|
boolean find = this.init != null && this.init.getName() == currentVersion.name;
|
||||||
|
if (currentVersion.name.equals(this.init.getName())) {
|
||||||
|
toApply = this.datas;
|
||||||
|
} else {
|
||||||
for (int iii=0; iii<this.datas.size(); iii++) {
|
for (int iii=0; iii<this.datas.size(); iii++) {
|
||||||
if ( ! find) {
|
if ( ! find) {
|
||||||
if (this.datas.get(iii).getName() == currentVersion.name) {
|
if (this.datas.get(iii).getName() == currentVersion.name) {
|
||||||
@ -175,6 +178,7 @@ public class MigrationEngine {
|
|||||||
toApply.add(this.datas.get(iii));
|
toApply.add(this.datas.get(iii));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
DBEntry entry = DBEntry.createInterface(config);
|
DBEntry entry = DBEntry.createInterface(config);
|
||||||
int id = 0;
|
int id = 0;
|
||||||
int count = toApply.size();
|
int count = toApply.size();
|
||||||
|
@ -45,7 +45,7 @@ public class JWTWrapper {
|
|||||||
public static void initLocalTokenRemote(String ssoUri, String application) throws IOException, ParseException {
|
public static void initLocalTokenRemote(String ssoUri, String application) throws IOException, ParseException {
|
||||||
// check Token:
|
// check Token:
|
||||||
URL obj = new URL(ssoUri + "public_key");
|
URL obj = new URL(ssoUri + "public_key");
|
||||||
logger.debug("Request token from: {}", obj);
|
//logger.debug("Request token from: {}", obj);
|
||||||
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
|
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
|
||||||
con.setRequestMethod("GET");
|
con.setRequestMethod("GET");
|
||||||
con.setRequestProperty("User-Agent", application);
|
con.setRequestProperty("User-Agent", application);
|
||||||
@ -58,7 +58,7 @@ public class JWTWrapper {
|
|||||||
}
|
}
|
||||||
int responseCode = con.getResponseCode();
|
int responseCode = con.getResponseCode();
|
||||||
|
|
||||||
logger.debug("GET Response Code :: {}", responseCode);
|
//logger.debug("GET Response Code :: {}", responseCode);
|
||||||
if (responseCode == HttpURLConnection.HTTP_OK) { // success
|
if (responseCode == HttpURLConnection.HTTP_OK) { // success
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ public class JWTWrapper {
|
|||||||
rsaPublicJWK = RSAKey.parse(values.key);
|
rsaPublicJWK = RSAKey.parse(values.key);
|
||||||
return;
|
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{
|
public static void initLocalToken(String baseUUID) throws Exception{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user