Commit 8fdc5a8a8b69949e1396b6e5e03d10543d29ba30

Authored by Igor Kulikov
1 parent 9151bfde

Fix: use time-based null UUID for public userId.

... ... @@ -25,6 +25,7 @@ import org.springframework.util.Assert;
25 25 import org.thingsboard.server.common.data.Customer;
26 26 import org.thingsboard.server.common.data.User;
27 27 import org.thingsboard.server.common.data.id.CustomerId;
  28 +import org.thingsboard.server.common.data.id.EntityId;
28 29 import org.thingsboard.server.common.data.id.UUIDBased;
29 30 import org.thingsboard.server.common.data.id.UserId;
30 31 import org.thingsboard.server.common.data.security.Authority;
... ... @@ -108,7 +109,7 @@ public class RefreshTokenAuthenticationProvider implements AuthenticationProvide
108 109 throw new BadCredentialsException("Refresh token is not valid");
109 110 }
110 111
111   - User user = new User(new UserId(UUIDBased.EMPTY));
  112 + User user = new User(new UserId(EntityId.NULL_UUID));
112 113 user.setTenantId(publicCustomer.getTenantId());
113 114 user.setCustomerId(publicCustomer.getId());
114 115 user.setEmail(publicId);
... ...
... ... @@ -26,6 +26,7 @@ import org.springframework.util.Assert;
26 26 import org.thingsboard.server.common.data.Customer;
27 27 import org.thingsboard.server.common.data.User;
28 28 import org.thingsboard.server.common.data.id.CustomerId;
  29 +import org.thingsboard.server.common.data.id.EntityId;
29 30 import org.thingsboard.server.common.data.id.UUIDBased;
30 31 import org.thingsboard.server.common.data.id.UserId;
31 32 import org.thingsboard.server.common.data.security.Authority;
... ... @@ -111,7 +112,7 @@ public class RestAuthenticationProvider implements AuthenticationProvider {
111 112 if (!publicCustomer.isPublic()) {
112 113 throw new BadCredentialsException("Authentication Failed. Public Id is not valid.");
113 114 }
114   - User user = new User(new UserId(UUIDBased.EMPTY));
  115 + User user = new User(new UserId(EntityId.NULL_UUID));
115 116 user.setTenantId(publicCustomer.getTenantId());
116 117 user.setCustomerId(publicCustomer.getId());
117 118 user.setEmail(publicId);
... ...
... ... @@ -20,8 +20,6 @@ import java.util.UUID;
20 20
21 21 public abstract class UUIDBased implements Serializable {
22 22
23   - public static final UUID EMPTY = new UUID(0L, 0L);
24   -
25 23 private static final long serialVersionUID = 1L;
26 24
27 25 private final UUID id;
... ...