Small code clean-up (#1815)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -12,18 +12,16 @@ package org.eclipse.hawkbit.im.authentication;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method for creation of <tt>GrantedAuthority</tt> collections etc.
|
* Utility method for creation of <tt>GrantedAuthority</tt> collections etc.
|
||||||
*/
|
*/
|
||||||
|
@NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)
|
||||||
public final class PermissionUtils {
|
public final class PermissionUtils {
|
||||||
|
|
||||||
private PermissionUtils() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all authorities.
|
* Returns all authorities.
|
||||||
*
|
*
|
||||||
@@ -32,4 +30,4 @@ public final class PermissionUtils {
|
|||||||
public static List<GrantedAuthority> createAllAuthorityList() {
|
public static List<GrantedAuthority> createAllAuthorityList() {
|
||||||
return SpPermission.getAllAuthorities().stream().map(SimpleGrantedAuthority::new).collect(Collectors.toList());
|
return SpPermission.getAllAuthorities().stream().map(SimpleGrantedAuthority::new).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,8 +17,7 @@ import lombok.Data;
|
|||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Security related hawkbit configuration.
|
* Security related hawkBit configuration.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@ConfigurationProperties("hawkbit.server.security")
|
@ConfigurationProperties("hawkbit.server.security")
|
||||||
|
|||||||
@@ -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
|
* Auditor class that allows BaseEntitys to insert current logged in user for
|
||||||
* repository changes.
|
* repository changes.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class SpringSecurityAuditorAware implements AuditorAware<String> {
|
public class SpringSecurityAuditorAware implements AuditorAware<String> {
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ package org.eclipse.hawkbit.security;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
@@ -76,8 +75,7 @@ public class SystemSecurityContext {
|
|||||||
* The system code is executed for a current tenant by using the
|
* The system code is executed for a current tenant by using the
|
||||||
* {@link TenantAware#getCurrentTenant()}.
|
* {@link TenantAware#getCurrentTenant()}.
|
||||||
*
|
*
|
||||||
* @param callable
|
* @param callable the callable to call within the system security context
|
||||||
* the callable to call within the system security context
|
|
||||||
* @return the return value of the {@link Callable#call()} method.
|
* @return the return value of the {@link Callable#call()} method.
|
||||||
*/
|
*/
|
||||||
// Exception squid:S2221 - Callable declares Exception
|
// 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
|
* The system code is executed for a specific given tenant by using the
|
||||||
* {@link TenantAware}.
|
* {@link TenantAware}.
|
||||||
*
|
*
|
||||||
* @param callable
|
* @param callable the callable to call within the system security context
|
||||||
* the callable to call within the system security context
|
* @param tenant the tenant to act as system code
|
||||||
* @param tenant
|
|
||||||
* the tenant to act as system code
|
|
||||||
* @return the return value of the {@link Callable#call()} method.
|
* @return the return value of the {@link Callable#call()} method.
|
||||||
*/
|
*/
|
||||||
// The callable API throws a Exception and not a specific one
|
// 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
|
* The security context will be switched to the a new
|
||||||
* {@link SecurityContext} and back after the callable is called.
|
* {@link SecurityContext} and back after the callable is called.
|
||||||
*
|
*
|
||||||
* @param tenant
|
* @param tenant under which the {@link Callable#call()} must be executed.
|
||||||
* under which the {@link Callable#call()} must be executed.
|
* @param callable to call within the security context
|
||||||
* @param callable
|
|
||||||
* to call within the security context
|
|
||||||
* @return the return value of the {@link Callable#call()} method.
|
* @return the return value of the {@link Callable#call()} method.
|
||||||
*/
|
*/
|
||||||
// The callable API throws a Exception and not a specific one
|
// The callable API throws a Exception and not a specific one
|
||||||
|
|||||||
Reference in New Issue
Block a user