Commit 6b7e7cd3e3f3e2496518f12e4462658dc1f44195

Authored by Chris Eykamp
1 parent 1bf04377

Rename function

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