[DEV] remove UUID that generate too much latency
This commit is contained in:
parent
d6eb3353e1
commit
71f8c0d548
@ -59,7 +59,7 @@ public class WebLauncher {
|
||||
rc.registerClasses(AuthenticationFilter.class);
|
||||
// add default resource:
|
||||
rc.registerClasses(UserResource.class);
|
||||
rc.registerClasses(PublicKeyResource.class);
|
||||
//rc.registerClasses(PublicKeyResource.class);
|
||||
rc.registerClasses(HealthCheck.class);
|
||||
// add jackson to be discover when we are ins stand-alone server
|
||||
rc.register(JacksonFeature.class);
|
||||
|
@ -250,7 +250,7 @@ public class UserResource {
|
||||
entry.disconnect();
|
||||
return Response.status(500).entity(result).build();
|
||||
}
|
||||
if (user == null || user.id == null) {
|
||||
if (user == null) {
|
||||
entry.disconnect();
|
||||
String result = "Authentiocate-wrong email/login '" + data.login + "')";
|
||||
System.out.println(" result: " + result);
|
||||
@ -270,7 +270,7 @@ public class UserResource {
|
||||
// unauthorized
|
||||
return Response.status(401).build();
|
||||
}
|
||||
String ret = JWTWrapper.generateJWToken(user.id.toString(), user.login, "KarAuth", 24*60);
|
||||
String ret = JWTWrapper.generateJWToken(user.id, user.login, "KarAuth", 24*60);
|
||||
System.out.println(" ==> generate token: " + ret);
|
||||
return Response.status(201).entity("{ \"jwt\":\"" + ret + "\"}").build();
|
||||
}
|
||||
|
@ -15,25 +15,31 @@ import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Application {
|
||||
public UUID id;
|
||||
public long id;
|
||||
public String description;
|
||||
public String token;
|
||||
public String redirect;
|
||||
public String redirectDev;
|
||||
public String notification;
|
||||
|
||||
public Application() {
|
||||
}
|
||||
|
||||
public Application(UUID id, String description, String token) {
|
||||
public Application(long id, String description, String redirect, String redirectDev, String notification) {
|
||||
this.id = id;
|
||||
this.description = description;
|
||||
this.token = token;
|
||||
this.redirect = redirect;
|
||||
this.redirectDev = redirectDev;
|
||||
this.notification = notification;
|
||||
}
|
||||
|
||||
public Application(ResultSet rs) {
|
||||
int iii = 1;
|
||||
try {
|
||||
this.id = UUID.fromString(rs.getString(iii++));
|
||||
this.id = rs.getLong(iii++);
|
||||
this.description = rs.getString(iii++);
|
||||
this.token = rs.getString(iii++);
|
||||
this.redirect = rs.getString(iii++);
|
||||
this.redirectDev = rs.getString(iii++);
|
||||
this.notification = rs.getString(iii++);
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
@ -44,7 +50,9 @@ public class Application {
|
||||
return "Application{" +
|
||||
"id=" + id +
|
||||
", description='" + description + '\'' +
|
||||
", token='" + token + '\'' +
|
||||
", redirect='" + redirect + '\'' +
|
||||
", redirectDev='" + redirectDev + '\'' +
|
||||
", notification='" + notification + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
public class User {
|
||||
public UUID id;
|
||||
public long id;
|
||||
public String date;
|
||||
public String login;
|
||||
public String password;
|
||||
@ -32,7 +32,7 @@ public class User {
|
||||
|
||||
public User() {}
|
||||
|
||||
public User(UUID id, String login, String password, String email, long emailValidate, String newEmail, State authorisationLevel) {
|
||||
public User(long id, String login, String password, String email, long emailValidate, String newEmail, State authorisationLevel) {
|
||||
this.id = id;
|
||||
this.login = login;
|
||||
this.password = password;
|
||||
@ -45,7 +45,7 @@ public class User {
|
||||
public User(ResultSet rs) {
|
||||
int iii = 1;
|
||||
try {
|
||||
this.id = UUID.fromString(rs.getString(iii++));
|
||||
this.id = rs.getLong(iii++);
|
||||
this.date = rs.getString(iii++);
|
||||
this.login = rs.getString(iii++);
|
||||
this.password = rs.getString(iii++);
|
||||
|
@ -19,7 +19,7 @@ import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
public class UserSmall {
|
||||
public UUID id;
|
||||
public long id;
|
||||
public String login;
|
||||
public String email;
|
||||
public State authorisationLevel;
|
||||
@ -27,14 +27,14 @@ public class UserSmall {
|
||||
|
||||
public UserSmall() {}
|
||||
|
||||
public UserSmall(UUID id, String login, String email, State authorisationLevel) {
|
||||
public UserSmall(long id, String login, String email, State authorisationLevel) {
|
||||
this.id = id;
|
||||
this.login = login;
|
||||
this.email = email;
|
||||
this.authorisationLevel = authorisationLevel;
|
||||
}
|
||||
|
||||
public UserSmall(UUID id, String login, String email, State authorisationLevel, boolean avatar) {
|
||||
public UserSmall(long id, String login, String email, State authorisationLevel, boolean avatar) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.login = login;
|
||||
@ -46,7 +46,7 @@ public class UserSmall {
|
||||
public UserSmall(ResultSet rs) {
|
||||
int iii = 1;
|
||||
try {
|
||||
this.id = UUID.fromString(rs.getString(iii++));
|
||||
this.id = rs.getLong(iii++);
|
||||
this.login = rs.getString(iii++);
|
||||
this.email = rs.getString(iii++);
|
||||
this.authorisationLevel = State.valueOf(rs.getString(iii++));
|
||||
|
@ -63,7 +63,7 @@ public class JWTWrapper {
|
||||
* @param timeOutInMunites Expiration of the token.
|
||||
* @return the encoded token
|
||||
*/
|
||||
public static String generateJWToken(String userID, String userLogin, String isuer, int timeOutInMunites) {
|
||||
public static String generateJWToken(long userID, String userLogin, String isuer, int timeOutInMunites) {
|
||||
if (rsaJWK == null) {
|
||||
System.out.println("JWT private key is not present !!!");
|
||||
return null;
|
||||
@ -73,7 +73,7 @@ public class JWTWrapper {
|
||||
JWSSigner signer = new RSASSASigner(rsaJWK);
|
||||
// Prepare JWT with claims set
|
||||
JWTClaimsSet claimsSet = new JWTClaimsSet.Builder()
|
||||
.subject(userID)
|
||||
.subject(Long.toString(userID))
|
||||
.claim("login", userLogin)
|
||||
.issuer(isuer)
|
||||
.issueTime(new Date())
|
||||
|
@ -22,7 +22,7 @@ export class AppComponent implements OnInit {
|
||||
constructor(
|
||||
private router: Router,
|
||||
private userService: UserService,
|
||||
private sessionService: SessionService) {
|
||||
private sessionService: SessionService) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -56,8 +56,8 @@ import { HttpWrapperService, PopInService, SessionService, SSOService, StorageSe
|
||||
providers: [
|
||||
PopInService,
|
||||
HttpWrapperService,
|
||||
StorageService,
|
||||
SessionService,
|
||||
StorageService,
|
||||
UserService,
|
||||
SSOService,
|
||||
],
|
||||
@ -69,7 +69,7 @@ import { HttpWrapperService, PopInService, SessionService, SSOService, StorageSe
|
||||
|
||||
PopInComponent,
|
||||
PopInUploadProgress,
|
||||
PopInDeleteConfirm
|
||||
PopInDeleteConfirm,
|
||||
],
|
||||
bootstrap: [
|
||||
AppComponent
|
||||
|
@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Logs } from 'selenium-webdriver';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
import { HTTPMimeType, HTTPRequestModel, HttpWrapperService, ModelResponseHttp } from './http-wrapper';
|
||||
|
Loading…
x
Reference in New Issue
Block a user