diff --git a/back/src/org/kar/karso/api/ApplicationTokenResource.java b/back/src/org/kar/karso/api/ApplicationTokenResource.java index 7c02251..c2256e2 100755 --- a/back/src/org/kar/karso/api/ApplicationTokenResource.java +++ b/back/src/org/kar/karso/api/ApplicationTokenResource.java @@ -52,7 +52,7 @@ public class ApplicationTokenResource { int nbRemoved = SqlWrapper.setDeleteWhere(ApplicationToken.class, List.of( new WhereCondition("parentId", "=", applicationId), - new WhereCondition("tokenId", "=", tokenId) + new WhereCondition("id", "=", tokenId) ) ); if (nbRemoved == 0) { @@ -79,7 +79,7 @@ public class ApplicationTokenResource { static String randomToken() { int len = 48; - String valid_element = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvxyz0123456789#_@-|[])('~$%*/\\.!?,"; + String valid_element = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvxyz0123456789#_@-~*!?"; // creating a StringBuffer size of AlphaNumericStr StringBuilder out = new StringBuilder(len); int iii; @@ -91,24 +91,24 @@ public class ApplicationTokenResource { } return out.toString(); } - + public record CreateRequest(String name, Integer validity) {}; @POST @Path("/{applicationId}/create") @RolesAllowed("ADMIN") public ApplicationToken createToken( @Context SecurityContext sc, @PathParam("applicationId") Long applicationId, - @FormDataParam("name") String name, - @FormDataParam("validity") Integer validity + CreateRequest request ) throws Exception { // correct input string stream : - name = multipartCorrection(name); + String name = multipartCorrection(request.name()); //validity = multipartCorrection(validity); System.out.println("create a nexw token..."); if (applicationId == null) { throw new InputException("applicationId", "can not be null"); } int maximum = 365*5; + Integer validity = request.validity(); if (validity == null || validity < 0 || validity > maximum) { validity = maximum; } @@ -126,7 +126,10 @@ public class ApplicationTokenResource { // here we return the token to permit to the user to see it to set it in the application. return token; } - + /* + Cannot find a deserializer for non-concrete Map type [map type; class jakarta.ws.rs.core.MultivaluedMap, [simple type, class java.lang.String] -> [collection type; class java.util.List, contains [simple type, class java.lang.String]]] + at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 1] + */ } diff --git a/front/src/app/scene/application-edit/application-edit.html b/front/src/app/scene/application-edit/application-edit.html index a9f738a..e103e79 100644 --- a/front/src/app/scene/application-edit/application-edit.html +++ b/front/src/app/scene/application-edit/application-edit.html @@ -8,13 +8,13 @@ - + @@ -33,7 +33,7 @@ @@ -52,7 +52,7 @@ @@ -60,7 +60,7 @@ @@ -86,20 +86,37 @@
id:{{application.id}}{{application?.id}}
Name: @@ -25,7 +25,7 @@ Description:
Redirect (http://): @@ -44,7 +44,7 @@ Redirect development (http://):
Notification address (http://):
TTL (seconds before expiration):
- - - - + + + + + - + +
idNameExpiration TimeTokenidNameExpiration TimeTokenActions
{{token.id}} {{token.name}}{{formatTimestamp(user.endValidityTime)}}{{formatTimestamp(token.endValidityTime)}} {{token.token}} + +