Commit 8fdc5a8a8b69949e1396b6e5e03d10543d29ba30
1 parent
9151bfde
Fix: use time-based null UUID for public userId.
Showing
3 changed files
with
4 additions
and
4 deletions
@@ -25,6 +25,7 @@ import org.springframework.util.Assert; | @@ -25,6 +25,7 @@ import org.springframework.util.Assert; | ||
25 | import org.thingsboard.server.common.data.Customer; | 25 | import org.thingsboard.server.common.data.Customer; |
26 | import org.thingsboard.server.common.data.User; | 26 | import org.thingsboard.server.common.data.User; |
27 | import org.thingsboard.server.common.data.id.CustomerId; | 27 | import org.thingsboard.server.common.data.id.CustomerId; |
28 | +import org.thingsboard.server.common.data.id.EntityId; | ||
28 | import org.thingsboard.server.common.data.id.UUIDBased; | 29 | import org.thingsboard.server.common.data.id.UUIDBased; |
29 | import org.thingsboard.server.common.data.id.UserId; | 30 | import org.thingsboard.server.common.data.id.UserId; |
30 | import org.thingsboard.server.common.data.security.Authority; | 31 | import org.thingsboard.server.common.data.security.Authority; |
@@ -108,7 +109,7 @@ public class RefreshTokenAuthenticationProvider implements AuthenticationProvide | @@ -108,7 +109,7 @@ public class RefreshTokenAuthenticationProvider implements AuthenticationProvide | ||
108 | throw new BadCredentialsException("Refresh token is not valid"); | 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 | user.setTenantId(publicCustomer.getTenantId()); | 113 | user.setTenantId(publicCustomer.getTenantId()); |
113 | user.setCustomerId(publicCustomer.getId()); | 114 | user.setCustomerId(publicCustomer.getId()); |
114 | user.setEmail(publicId); | 115 | user.setEmail(publicId); |
@@ -26,6 +26,7 @@ import org.springframework.util.Assert; | @@ -26,6 +26,7 @@ import org.springframework.util.Assert; | ||
26 | import org.thingsboard.server.common.data.Customer; | 26 | import org.thingsboard.server.common.data.Customer; |
27 | import org.thingsboard.server.common.data.User; | 27 | import org.thingsboard.server.common.data.User; |
28 | import org.thingsboard.server.common.data.id.CustomerId; | 28 | import org.thingsboard.server.common.data.id.CustomerId; |
29 | +import org.thingsboard.server.common.data.id.EntityId; | ||
29 | import org.thingsboard.server.common.data.id.UUIDBased; | 30 | import org.thingsboard.server.common.data.id.UUIDBased; |
30 | import org.thingsboard.server.common.data.id.UserId; | 31 | import org.thingsboard.server.common.data.id.UserId; |
31 | import org.thingsboard.server.common.data.security.Authority; | 32 | import org.thingsboard.server.common.data.security.Authority; |
@@ -111,7 +112,7 @@ public class RestAuthenticationProvider implements AuthenticationProvider { | @@ -111,7 +112,7 @@ public class RestAuthenticationProvider implements AuthenticationProvider { | ||
111 | if (!publicCustomer.isPublic()) { | 112 | if (!publicCustomer.isPublic()) { |
112 | throw new BadCredentialsException("Authentication Failed. Public Id is not valid."); | 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 | user.setTenantId(publicCustomer.getTenantId()); | 116 | user.setTenantId(publicCustomer.getTenantId()); |
116 | user.setCustomerId(publicCustomer.getId()); | 117 | user.setCustomerId(publicCustomer.getId()); |
117 | user.setEmail(publicId); | 118 | user.setEmail(publicId); |
@@ -20,8 +20,6 @@ import java.util.UUID; | @@ -20,8 +20,6 @@ import java.util.UUID; | ||
20 | 20 | ||
21 | public abstract class UUIDBased implements Serializable { | 21 | public abstract class UUIDBased implements Serializable { |
22 | 22 | ||
23 | - public static final UUID EMPTY = new UUID(0L, 0L); | ||
24 | - | ||
25 | private static final long serialVersionUID = 1L; | 23 | private static final long serialVersionUID = 1L; |
26 | 24 | ||
27 | private final UUID id; | 25 | private final UUID id; |