Browse Source

Set default value to 'false' for 'isOAuth2ConfigAllowed'

pull/3557/head
vzikratyi 6 years ago
parent
commit
86aacc07ae
  1. 2
      dao/src/main/java/org/thingsboard/server/dao/oauth2/OAuth2ServiceImpl.java
  2. 2
      dao/src/test/java/org/thingsboard/server/dao/service/BaseOAuth2ServiceTest.java

2
dao/src/main/java/org/thingsboard/server/dao/oauth2/OAuth2ServiceImpl.java

@ -129,7 +129,7 @@ public class OAuth2ServiceImpl extends AbstractEntityService implements OAuth2Se
if (tenant == null) return false;
JsonNode allowOAuth2ConfigurationJsonNode = tenant.getAdditionalInfo() != null ? tenant.getAdditionalInfo().get(ALLOW_OAUTH2_CONFIGURATION) : null;
if (allowOAuth2ConfigurationJsonNode == null) {
return true;
return false;
} else {
return allowOAuth2ConfigurationJsonNode.asBoolean();
}

2
dao/src/test/java/org/thingsboard/server/dao/service/BaseOAuth2ServiceTest.java

@ -66,7 +66,7 @@ public class BaseOAuth2ServiceTest extends AbstractServiceTest {
@Test
public void testIsOAuth2Allowed_null() throws IOException {
updateTenantAllowOAuth2Setting(null);
Assert.assertTrue(oAuth2Service.isOAuth2ClientRegistrationAllowed(tenantId));
Assert.assertFalse(oAuth2Service.isOAuth2ClientRegistrationAllowed(tenantId));
}
@Test

Loading…
Cancel
Save