diff --git a/back/src/org/kar/oauth/WebLauncher.java b/back/src/org/kar/oauth/WebLauncher.java index 81fdc44..7076b9a 100755 --- a/back/src/org/kar/oauth/WebLauncher.java +++ b/back/src/org/kar/oauth/WebLauncher.java @@ -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); diff --git a/back/src/org/kar/oauth/api/UserResource.java b/back/src/org/kar/oauth/api/UserResource.java index 0c266ab..d797220 100755 --- a/back/src/org/kar/oauth/api/UserResource.java +++ b/back/src/org/kar/oauth/api/UserResource.java @@ -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(); } diff --git a/back/src/org/kar/oauth/model/Application.java b/back/src/org/kar/oauth/model/Application.java index 0f0fd85..d4c9eb5 100644 --- a/back/src/org/kar/oauth/model/Application.java +++ b/back/src/org/kar/oauth/model/Application.java @@ -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 + '\'' + '}'; } } diff --git a/back/src/org/kar/oauth/model/User.java b/back/src/org/kar/oauth/model/User.java index 197203f..0b97097 100644 --- a/back/src/org/kar/oauth/model/User.java +++ b/back/src/org/kar/oauth/model/User.java @@ -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++); diff --git a/back/src/org/kar/oauth/model/UserSmall.java b/back/src/org/kar/oauth/model/UserSmall.java index 80059fc..d2e5582 100644 --- a/back/src/org/kar/oauth/model/UserSmall.java +++ b/back/src/org/kar/oauth/model/UserSmall.java @@ -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++)); diff --git a/back/src/org/kar/oauth/util/JWTWrapper.java b/back/src/org/kar/oauth/util/JWTWrapper.java index e9d2744..3588f8a 100644 --- a/back/src/org/kar/oauth/util/JWTWrapper.java +++ b/back/src/org/kar/oauth/util/JWTWrapper.java @@ -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()) diff --git a/front/src/app/app.component.ts b/front/src/app/app.component.ts index 9b2bc6c..bb0ef8f 100644 --- a/front/src/app/app.component.ts +++ b/front/src/app/app.component.ts @@ -22,7 +22,7 @@ export class AppComponent implements OnInit { constructor( private router: Router, private userService: UserService, - private sessionService: SessionService) { + private sessionService: SessionService) { } diff --git a/front/src/app/app.module.ts b/front/src/app/app.module.ts index 82695a8..912e4ea 100644 --- a/front/src/app/app.module.ts +++ b/front/src/app/app.module.ts @@ -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 diff --git a/front/src/app/service/user.ts b/front/src/app/service/user.ts index fcce79d..23f4bf5 100644 --- a/front/src/app/service/user.ts +++ b/front/src/app/service/user.ts @@ -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';