From e10542929a7abdd274c763d33f6e073adf7d1676 Mon Sep 17 00:00:00 2001 From: Avgustin Marinov Date: Mon, 12 Aug 2024 09:11:19 +0300 Subject: [PATCH] Small code clean-up (#1815) Signed-off-by: Marinov Avgustin --- .../im/authentication/PermissionUtils.java | 8 +++----- .../security/HawkbitSecurityProperties.java | 3 +-- .../security/SpringSecurityAuditorAware.java | 1 - .../hawkbit/security/SystemSecurityContext.java | 16 +++++----------- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/PermissionUtils.java b/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/PermissionUtils.java index 713a47bff..3e016d74d 100644 --- a/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/PermissionUtils.java +++ b/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/PermissionUtils.java @@ -12,18 +12,16 @@ package org.eclipse.hawkbit.im.authentication; import java.util.List; import java.util.stream.Collectors; +import lombok.NoArgsConstructor; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; /** * Utility method for creation of GrantedAuthority collections etc. */ +@NoArgsConstructor(access = lombok.AccessLevel.PRIVATE) public final class PermissionUtils { - private PermissionUtils() { - - } - /** * Returns all authorities. * @@ -32,4 +30,4 @@ public final class PermissionUtils { public static List createAllAuthorityList() { return SpPermission.getAllAuthorities().stream().map(SimpleGrantedAuthority::new).collect(Collectors.toList()); } -} +} \ No newline at end of file diff --git a/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/HawkbitSecurityProperties.java b/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/HawkbitSecurityProperties.java index bba48e7ec..7266f2a53 100644 --- a/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/HawkbitSecurityProperties.java +++ b/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/HawkbitSecurityProperties.java @@ -17,8 +17,7 @@ import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; /** - * Security related hawkbit configuration. - * + * Security related hawkBit configuration. */ @Data @ConfigurationProperties("hawkbit.server.security") diff --git a/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SpringSecurityAuditorAware.java b/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SpringSecurityAuditorAware.java index 6580e9be8..0f5d52f24 100644 --- a/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SpringSecurityAuditorAware.java +++ b/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SpringSecurityAuditorAware.java @@ -20,7 +20,6 @@ import org.springframework.security.oauth2.core.oidc.user.OidcUser; /** * Auditor class that allows BaseEntitys to insert current logged in user for * repository changes. - * */ public class SpringSecurityAuditorAware implements AuditorAware { diff --git a/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SystemSecurityContext.java b/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SystemSecurityContext.java index ca355332f..ef3615311 100644 --- a/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SystemSecurityContext.java +++ b/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SystemSecurityContext.java @@ -12,7 +12,6 @@ package org.eclipse.hawkbit.security; import java.util.Collection; import java.util.Collections; import java.util.List; -import java.util.Set; import java.util.UUID; import java.util.concurrent.Callable; @@ -76,8 +75,7 @@ public class SystemSecurityContext { * The system code is executed for a current tenant by using the * {@link TenantAware#getCurrentTenant()}. * - * @param callable - * the callable to call within the system security context + * @param callable the callable to call within the system security context * @return the return value of the {@link Callable#call()} method. */ // Exception squid:S2221 - Callable declares Exception @@ -100,10 +98,8 @@ public class SystemSecurityContext { * The system code is executed for a specific given tenant by using the * {@link TenantAware}. * - * @param callable - * the callable to call within the system security context - * @param tenant - * the tenant to act as system code + * @param callable the callable to call within the system security context + * @param tenant the tenant to act as system code * @return the return value of the {@link Callable#call()} method. */ // The callable API throws a Exception and not a specific one @@ -136,10 +132,8 @@ public class SystemSecurityContext { * The security context will be switched to the a new * {@link SecurityContext} and back after the callable is called. * - * @param tenant - * under which the {@link Callable#call()} must be executed. - * @param callable - * to call within the security context + * @param tenant under which the {@link Callable#call()} must be executed. + * @param callable to call within the security context * @return the return value of the {@link Callable#call()} method. */ // The callable API throws a Exception and not a specific one