[DEBUG] missing some fiole for productions
This commit is contained in:
parent
ec2f7d4a7f
commit
93f0915574
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.kar</groupId>
|
||||
<artifactId>karso</artifactId>
|
||||
<version>0.4.2</version>
|
||||
<version>0.4.3</version>
|
||||
<properties>
|
||||
<!--
|
||||
<jaxb.version>2.3.1</jaxb.version>
|
||||
@ -24,7 +24,7 @@
|
||||
<dependency>
|
||||
<groupId>kangaroo-and-rabbit</groupId>
|
||||
<artifactId>archidata</artifactId>
|
||||
<version>0.3.6</version>
|
||||
<version>0.3.7</version>
|
||||
</dependency>
|
||||
<!-- testing -->
|
||||
<dependency>
|
||||
@ -44,6 +44,11 @@
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<testSourceDirectory>test/src</testSourceDirectory>
|
||||
<directory>${project.basedir}/out/maven/</directory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -23,7 +23,6 @@ import org.kar.archidata.catcher.FailException404API;
|
||||
import org.kar.archidata.catcher.FailExceptionCatcher;
|
||||
import org.kar.archidata.catcher.InputExceptionCatcher;
|
||||
import org.kar.archidata.catcher.SystemExceptionCatcher;
|
||||
import org.kar.archidata.db.DBEntry;
|
||||
import org.kar.archidata.filter.CORSFilter;
|
||||
import org.kar.archidata.util.ConfigBaseVariable;
|
||||
import org.kar.archidata.util.JWTWrapper;
|
||||
@ -46,8 +45,11 @@ public class WebLauncher {
|
||||
return UriBuilder.fromUri(ConfigBaseVariable.getlocalAddress()).build();
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
public static void main(String[] args) throws Exception {
|
||||
WebLauncher.LOGGER.info("[START] application wake UP");
|
||||
WebLauncher launcher = new WebLauncher();
|
||||
launcher.migrateDB();
|
||||
|
||||
launcher.process();
|
||||
WebLauncher.LOGGER.info("end-configure the server & wait finish process:");
|
||||
Thread.currentThread().join();
|
||||
@ -55,9 +57,15 @@ public class WebLauncher {
|
||||
}
|
||||
|
||||
public void migrateDB() throws Exception {
|
||||
WebLauncher.LOGGER.info("Create migration engine");
|
||||
MigrationEngine migrationEngine = new MigrationEngine();
|
||||
WebLauncher.LOGGER.info("Add initialization");
|
||||
migrationEngine.setInit(new Initialization());
|
||||
WebLauncher.LOGGER.info("Add migration since last version");
|
||||
// NOTHING for now
|
||||
WebLauncher.LOGGER.info("Migrate the DB [START]");
|
||||
migrationEngine.migrate(GlobalConfiguration.dbConfig);
|
||||
WebLauncher.LOGGER.info("Migrate the DB [STOP]");
|
||||
}
|
||||
|
||||
public void process() throws InterruptedException {
|
||||
|
@ -10,7 +10,7 @@ public class WebLauncherEdgeLocal {
|
||||
final Logger logger = LoggerFactory.getLogger(WebLauncherEdgeLocal.class);
|
||||
private WebLauncherEdgeLocal() {}
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
public static void main(String[] args) throws Exception {
|
||||
if (true) {
|
||||
// for local test:
|
||||
ConfigBaseVariable.apiAdress = "http://0.0.0.0:15080/karso/api/";
|
||||
|
@ -225,7 +225,8 @@ public class ApplicationResource {
|
||||
@RolesAllowed(value= {"USER", "ADMIN"})
|
||||
public Response getClientToken(@Context SecurityContext sc, @QueryParam("application") String application) throws Exception {
|
||||
GenericContext gc = (GenericContext) sc.getUserPrincipal();
|
||||
logger.debug("== USER ? {}", gc.userByToken);
|
||||
logger.info("get application TOKEN application name='{}'", application);
|
||||
logger.debug("== USER ? {}", gc.userByToken.name);
|
||||
|
||||
if (application == null) {
|
||||
String result = "Input error missing parameter: 'application'";
|
||||
@ -285,7 +286,7 @@ public class ApplicationResource {
|
||||
Map<String, Object> outRight = new HashMap<>();
|
||||
// we set the right in the under map to manage multiple application group right. and in some application user can see other user or all user of the application
|
||||
outRight.put(applicationName, applicationRight);
|
||||
String ret = JWTWrapper.generateJWToken(gc.userByToken.id, gc.userByToken.name, "KarAuth", applicationName, outRight, appl.ttl);
|
||||
String ret = JWTWrapper.generateJWToken(gc.userByToken.id, gc.userByToken.name, "KarAuth", applicationName, outRight, -appl.ttl);
|
||||
//logger.debug(" ==> generate token: {}", ret);
|
||||
String returnAdress = appl.redirect;
|
||||
if (isDev) {
|
||||
|
@ -109,10 +109,11 @@ public class ApplicationTokenResource {
|
||||
@PathParam("applicationId") Long applicationId,
|
||||
CreateRequest request
|
||||
) throws Exception {
|
||||
logger.info("get user application TOKEN: app='{}' user='???'", applicationId);
|
||||
// correct input string stream :
|
||||
String name = multipartCorrection(request.name());
|
||||
//validity = multipartCorrection(validity);
|
||||
logger.debug("create a nexw token...");
|
||||
logger.debug("create a new token...");
|
||||
if (applicationId == null) {
|
||||
throw new InputException("applicationId", "can not be null");
|
||||
}
|
||||
@ -121,6 +122,7 @@ public class ApplicationTokenResource {
|
||||
if (validity == null || validity < 0 || validity > maximum) {
|
||||
validity = maximum;
|
||||
}
|
||||
logger.warn("validity= {}", validity);
|
||||
// todo: set validity timestamp ...
|
||||
// TODO: check if application exist ...
|
||||
ApplicationToken token = new ApplicationToken();
|
||||
@ -128,7 +130,9 @@ public class ApplicationTokenResource {
|
||||
token.name = multipartCorrection(name);
|
||||
token.parentId = applicationId;
|
||||
OffsetDateTime now = OffsetDateTime.now( ZoneOffset.UTC );
|
||||
logger.warn("Check Timestamp now = {}", now);
|
||||
token.endValidityTime = Timestamp.from(now.plusDays(validity).toInstant());
|
||||
logger.warn("token.endValidityTime = {}", token.endValidityTime);
|
||||
|
||||
// insert in the BDD
|
||||
token = SqlWrapper.insert(token);
|
||||
|
@ -306,6 +306,7 @@ public class UserResource {
|
||||
@PermitAll
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public GetToken getToken(DataGetToken data) throws Exception {
|
||||
logger.info("User Authenticate: {}", data.login());
|
||||
UserAuth user = checkAuthUser(data.method(), data.login(), data.time(), data.password());
|
||||
// at the point the user has been not deleted and not blocked.
|
||||
// this authentication is valid only for Karso ==> not for the application
|
||||
@ -322,6 +323,7 @@ public class UserResource {
|
||||
String applicationName = "karso";
|
||||
// we set the right in the under map to manage multiple application group right. and in some application user can see other user or all user of the application
|
||||
outRight.put(applicationName, ssoRight);
|
||||
// TODO: maybe correct this get of TTL...
|
||||
String ret = JWTWrapper.generateJWToken(user.id, user.login, "KarAuth", applicationName, outRight, expirationTimeInMinutes);
|
||||
|
||||
// Update last connection:
|
||||
|
55
back/src/org/kar/karso/util/Transform.java
Normal file
55
back/src/org/kar/karso/util/Transform.java
Normal file
@ -0,0 +1,55 @@
|
||||
package org.kar.karso.util;
|
||||
|
||||
public class Transform {
|
||||
|
||||
public static Object convertToType(String type, String value) {
|
||||
if ("BOOLEAN".equals(type)) {
|
||||
return Boolean.valueOf(value);
|
||||
} else if ("STRING".equals(type)) {
|
||||
return value;
|
||||
} else if ("LONG".equals(type)) {
|
||||
return Long.valueOf(value);
|
||||
} else if ("NUMBER".equals(type)) {
|
||||
return Double.valueOf(value);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String convertToStringCheck(String type, Object value) {
|
||||
if ("BOOLEAN".equals(type)) {
|
||||
if (value instanceof Boolean tmp) {
|
||||
return String.valueOf(tmp);
|
||||
}
|
||||
} else if ("STRING".equals(type)) {
|
||||
if (value instanceof String tmp) {
|
||||
return tmp;
|
||||
}
|
||||
} else if ("LONG".equals(type)) {
|
||||
if (value instanceof Long tmp) {
|
||||
return String.valueOf(tmp);
|
||||
} else if (value instanceof Integer tmp) {
|
||||
return String.valueOf(tmp);
|
||||
} else if (value instanceof Short tmp) {
|
||||
return String.valueOf(tmp);
|
||||
} else if (value instanceof Float tmp) {
|
||||
return String.valueOf(Math.round(tmp));
|
||||
} else if (value instanceof Double tmp) {
|
||||
return String.valueOf(Math.round(tmp));
|
||||
}
|
||||
} else if ("NUMBER".equals(type)) {
|
||||
if (value instanceof Long tmp) {
|
||||
return String.valueOf(tmp);
|
||||
} else if (value instanceof Integer tmp) {
|
||||
return String.valueOf(tmp);
|
||||
} else if (value instanceof Short tmp) {
|
||||
return String.valueOf(tmp);
|
||||
} else if (value instanceof Float tmp) {
|
||||
return String.valueOf(tmp);
|
||||
} else if (value instanceof Double tmp) {
|
||||
return String.valueOf(tmp);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
35
back/src/resources/simplelogger.properties
Normal file
35
back/src/resources/simplelogger.properties
Normal file
@ -0,0 +1,35 @@
|
||||
# SLF4J's SimpleLogger configuration file
|
||||
# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err.
|
||||
# Default logging detail level for all instances of SimpleLogger.
|
||||
# Must be one of ("trace", "debug", "info", "warn", or "error").
|
||||
# If not specified, defaults to "info".
|
||||
org.slf4j.simpleLogger.defaultLogLevel=trace
|
||||
|
||||
# Logging detail level for a SimpleLogger instance named "xxxxx".
|
||||
# Must be one of ("trace", "debug", "info", "warn", or "error").
|
||||
# If not specified, the default logging detail level is used.
|
||||
#org.slf4j.simpleLogger.log.xxxxx=
|
||||
|
||||
# Set to true if you want the current date and time to be included in output messages.
|
||||
# Default is false, and will output the number of milliseconds elapsed since startup.
|
||||
#org.slf4j.simpleLogger.showDateTime=false
|
||||
|
||||
# The date and time format to be used in the output messages.
|
||||
# The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat.
|
||||
# If the format is not specified or is invalid, the default format is used.
|
||||
# The default format is yyyy-MM-dd HH:mm:ss:SSS Z.
|
||||
#org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z
|
||||
|
||||
# Set to true if you want to output the current thread name.
|
||||
# Defaults to true.
|
||||
org.slf4j.simpleLogger.showThreadName=true
|
||||
|
||||
# Set to true if you want the Logger instance name to be included in output messages.
|
||||
# Defaults to true.
|
||||
#org.slf4j.simpleLogger.showLogName=true
|
||||
|
||||
# Set to true if you want the last component of the name to be included in output messages.
|
||||
# Defaults to false.
|
||||
#org.slf4j.simpleLogger.showShortLogName=false
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user