Browse Source

Added 'alwaysFullScreen' and 'defaultDashboardName' oauth2 properties

pull/2806/head
viktor 6 years ago
parent
commit
cac7eb0d2b
  1. 4
      application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/BasicOAuth2ClientMapper.java
  2. 4
      application/src/main/resources/thingsboard.yml
  3. 2
      common/dao-api/src/main/java/org/thingsboard/server/dao/oauth2/OAuth2User.java
  4. 2
      dao/src/main/java/org/thingsboard/server/dao/oauth2/OAuth2ClientMapperConfig.java

4
application/src/main/java/org/thingsboard/server/service/security/auth/oauth2/BasicOAuth2ClientMapper.java

@ -56,6 +56,10 @@ public class BasicOAuth2ClientMapper extends AbstractOAuth2ClientMapper implemen
String customerName = sub.replace(config.getBasic().getCustomerNamePattern());
oauth2User.setCustomerName(customerName);
}
oauth2User.setAlwaysFullScreen(config.getBasic().isAlwaysFullScreen());
if (!StringUtils.isEmpty(config.getBasic().getDefaultDashboardName())) {
oauth2User.setDefaultDashboardName(config.getBasic().getDefaultDashboardName());
}
return getOrCreateSecurityUserFromOAuth2User(oauth2User, config.isAllowUserCreation(), config.isActivateUser());
}

4
application/src/main/resources/thingsboard.yml

@ -148,6 +148,10 @@ security:
# If this field is not empty, user will be created as a user under defined Customer
# %{attribute_key} as placeholder for attribute value of attributes of external user object
customerNamePattern: "${SECURITY_OAUTH2_DEFAULT_MAPPER_BASIC_CUSTOMER_NAME_PATTERN:}"
# If this field is not empty, user will be created with default defined Dashboard
defaultDashboardName: "${SECURITY_OAUTH2_DEFAULT_MAPPER_BASIC_DEFAULT_DASHBOARD_NAME:}"
# If this field is set 'true' along with non-empty 'defaultDashboardName', user will start from the defined Dashboard in fullscreen mode
alwaysFullScreen: "${SECURITY_OAUTH2_DEFAULT_MAPPER_BASIC_ALWAYS_FULL_SCREEN:false}"
custom:
url: "${SECURITY_OAUTH2_DEFAULT_MAPPER_CUSTOM_URL:}"
username: "${SECURITY_OAUTH2_DEFAULT_MAPPER_CUSTOM_USERNAME:}"

2
common/dao-api/src/main/java/org/thingsboard/server/dao/oauth2/OAuth2User.java

@ -28,4 +28,6 @@ public class OAuth2User {
private String email;
private String firstName;
private String lastName;
private boolean alwaysFullScreen;
private String defaultDashboardName;
}

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

@ -34,6 +34,8 @@ public class OAuth2ClientMapperConfig {
private String tenantNameStrategy;
private String tenantNamePattern;
private String customerNamePattern;
private boolean alwaysFullScreen;
private String defaultDashboardName;
}
@Data

Loading…
Cancel
Save