diff options
author | Zipeng WU <zipeng.wu@sonarsource.com> | 2023-01-10 11:51:59 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-01-12 20:02:51 +0000 |
commit | c6a817468bcd71129f9da2b453a5a91af62df570 (patch) | |
tree | 0b20f3dd739bcb89c0e802c2d51724cbe8a7e70e /server/sonar-auth-ldap/src/main/java | |
parent | 2b61542b6a77fdfb62ff5a815856d3babee28a1a (diff) | |
download | sonarqube-c6a817468bcd71129f9da2b453a5a91af62df570.tar.gz sonarqube-c6a817468bcd71129f9da2b453a5a91af62df570.zip |
[NO-JIRA] Use record for data classes
Diffstat (limited to 'server/sonar-auth-ldap/src/main/java')
4 files changed, 4 insertions, 48 deletions
diff --git a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapGroupsProvider.java b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapGroupsProvider.java index 42bef16f57d..6f7515c1138 100644 --- a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapGroupsProvider.java +++ b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapGroupsProvider.java @@ -56,7 +56,7 @@ public class DefaultLdapGroupsProvider implements LdapGroupsProvider { */ @Override public Collection<String> doGetGroups(Context context) { - return getGroups(context.getServerKey(), context.getUsername()); + return getGroups(context.serverKey(), context.username()); } private Collection<String> getGroups(String serverKey, String username) { diff --git a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapUsersProvider.java b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapUsersProvider.java index ae18f897b73..d9af9e48357 100644 --- a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapUsersProvider.java +++ b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/DefaultLdapUsersProvider.java @@ -55,7 +55,7 @@ public class DefaultLdapUsersProvider implements LdapUsersProvider { @Override public LdapUserDetails doGetUserDetails(Context context) { - return getUserDetails(context.getServerKey(), context.getUsername()); + return getUserDetails(context.serverKey(), context.username()); } /** diff --git a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapGroupsProvider.java b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapGroupsProvider.java index 337e39fa3b9..629ead08265 100644 --- a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapGroupsProvider.java +++ b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapGroupsProvider.java @@ -26,27 +26,6 @@ public interface LdapGroupsProvider { Collection<String> doGetGroups(Context context); - final class Context { - private final String serverKey; - private final String username; - private final HttpServletRequest request; - - public Context(String serverKey, String username, HttpServletRequest request) { - this.serverKey = serverKey; - this.username = username; - this.request = request; - } - - public String getServerKey() { - return serverKey; - } - - public String getUsername() { - return username; - } - - public HttpServletRequest getRequest() { - return request; - } + record Context(String serverKey, String username, HttpServletRequest request) { } } diff --git a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapUsersProvider.java b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapUsersProvider.java index d7a2e4ea50b..7c3ba105863 100644 --- a/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapUsersProvider.java +++ b/server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapUsersProvider.java @@ -25,30 +25,7 @@ public interface LdapUsersProvider { LdapUserDetails doGetUserDetails(Context context); - final class Context { - private final String username; - - private final String serverKey; - - private final HttpServletRequest request; - - public Context(String serverKey, String username, HttpServletRequest request) { - this.username = username; - this.serverKey = serverKey; - this.request = request; - } - - public String getUsername() { - return username; - } - - public String getServerKey() { - return serverKey; - } - - public HttpServletRequest getRequest() { - return request; - } + record Context(String serverKey, String username, HttpServletRequest request) { } } |