Showing
4 changed files
with
8 additions
and
6 deletions
... | ... | @@ -56,7 +56,7 @@ public class CustomerController extends BaseController { |
56 | 56 | ObjectMapper objectMapper = new ObjectMapper(); |
57 | 57 | ObjectNode infoObject = objectMapper.createObjectNode(); |
58 | 58 | infoObject.put("title", customer.getTitle()); |
59 | - infoObject.put("isPublic", customer.publicCustomer()); | |
59 | + infoObject.put("isPublic", customer.isPublic()); | |
60 | 60 | return infoObject; |
61 | 61 | } catch (Exception e) { |
62 | 62 | throw handleException(e); | ... | ... |
... | ... | @@ -104,7 +104,7 @@ public class RefreshTokenAuthenticationProvider implements AuthenticationProvide |
104 | 104 | throw new UsernameNotFoundException("Public entity not found by refresh token"); |
105 | 105 | } |
106 | 106 | |
107 | - if (!publicCustomer.publicCustomer()) { | |
107 | + if (!publicCustomer.isPublic()) { | |
108 | 108 | throw new BadCredentialsException("Refresh token is not valid"); |
109 | 109 | } |
110 | 110 | ... | ... |
... | ... | @@ -108,7 +108,7 @@ public class RestAuthenticationProvider implements AuthenticationProvider { |
108 | 108 | if (publicCustomer == null) { |
109 | 109 | throw new UsernameNotFoundException("Public entity not found: " + publicId); |
110 | 110 | } |
111 | - if (!publicCustomer.publicCustomer()) { | |
111 | + if (!publicCustomer.isPublic()) { | |
112 | 112 | throw new BadCredentialsException("Authentication Failed. Public Id is not valid."); |
113 | 113 | } |
114 | 114 | User user = new User(new UserId(UUIDBased.EMPTY)); | ... | ... |
... | ... | @@ -15,6 +15,7 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.common.data; |
17 | 17 | |
18 | +import com.fasterxml.jackson.annotation.JsonIgnore; | |
18 | 19 | import com.fasterxml.jackson.annotation.JsonProperty; |
19 | 20 | import com.fasterxml.jackson.annotation.JsonProperty.Access; |
20 | 21 | import org.thingsboard.server.common.data.id.CustomerId; |
... | ... | @@ -61,11 +62,12 @@ public class Customer extends ContactBased<CustomerId> implements HasName { |
61 | 62 | this.title = title; |
62 | 63 | } |
63 | 64 | |
64 | - public boolean publicCustomer() { // Using better name isPublic causes tests to fail | |
65 | + @JsonIgnore | |
66 | + public boolean isPublic() { | |
65 | 67 | if (getAdditionalInfo() != null && getAdditionalInfo().has("isPublic")) { |
66 | - return getAdditionalInfo().get("isPublic").asBoolean(); | |
68 | + return additionalInfo.get("isPublic").asBoolean(); | |
67 | 69 | } |
68 | - | |
70 | + | |
69 | 71 | return false; |
70 | 72 | } |
71 | 73 | ... | ... |