Remove swagger and minor feature extensions and bug fixes
- Various Bug fixes and improvements - Management API extended - Swagger removed - Guava Upgraded to 19
This commit is contained in:
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/ExcludePathAwareShallowETagFilter.java
Executable file → Normal file
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/ExcludePathAwareShallowETagFilter.java
Executable file → Normal file
4
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/MultitenancyIndicator.java
Executable file → Normal file
4
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/MultitenancyIndicator.java
Executable file → Normal file
@@ -13,13 +13,13 @@ import org.springframework.security.authentication.AuthenticationProvider;
|
||||
/**
|
||||
* Indicates if the SP server runs in multi-tenancy mode. By means e.g. if a
|
||||
* login screen needs to allow to specifiy the tenant to login.
|
||||
*
|
||||
*
|
||||
* This can defere e.g. in case if the {@link AuthenticationProvider} allows
|
||||
* {@link TenantUserPasswordAuthenticationToken} tokens or not.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface MultitenancyIndicator {
|
||||
|
||||
/**
|
||||
|
||||
29
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/PermissionService.java
Executable file → Normal file
29
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/PermissionService.java
Executable file → Normal file
@@ -25,7 +25,7 @@ public class PermissionService {
|
||||
/**
|
||||
* Checks if the given {@code permission} contains in the. In case no
|
||||
* {@code context} is available {@code false} will be returned.
|
||||
*
|
||||
*
|
||||
* @param permission
|
||||
* the permission to check against the
|
||||
* @return {@code true} if a is available and contains the given
|
||||
@@ -52,7 +52,7 @@ public class PermissionService {
|
||||
}
|
||||
|
||||
public List<String> getAllPermission() {
|
||||
final List<String> permissions = new ArrayList<String>();
|
||||
final List<String> permissions = new ArrayList<>();
|
||||
final SecurityContext context = SecurityContextHolder.getContext();
|
||||
if (context == null) {
|
||||
return permissions;
|
||||
@@ -71,7 +71,7 @@ public class PermissionService {
|
||||
* Checks if at least on permission of the given {@code permissions}
|
||||
* contains in the . In case no {@code context} is available {@code false}
|
||||
* will be returned.
|
||||
*
|
||||
*
|
||||
* @param permissions
|
||||
* the permissions to check against the
|
||||
* @return {@code true} if a is available and contains the given
|
||||
@@ -80,18 +80,23 @@ public class PermissionService {
|
||||
*/
|
||||
public boolean hasAtLeastOnePermission(final List<String> permissions) {
|
||||
final SecurityContext context = SecurityContextHolder.getContext();
|
||||
if (context != null) {
|
||||
final Authentication authentication = context.getAuthentication();
|
||||
if (authentication != null) {
|
||||
for (final GrantedAuthority authority : authentication.getAuthorities()) {
|
||||
for (final String permission : permissions) {
|
||||
if (authority.getAuthority().equals(permission)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (context == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Authentication authentication = context.getAuthentication();
|
||||
if (authentication == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (final GrantedAuthority authority : authentication.getAuthorities()) {
|
||||
for (final String permission : permissions) {
|
||||
if (authority.getAuthority().equals(permission)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/SpPermission.java
Executable file → Normal file
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/SpPermission.java
Executable file → Normal file
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/TenantAwareAuthenticationDetails.java
Executable file → Normal file
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/TenantAwareAuthenticationDetails.java
Executable file → Normal file
9
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/TenantUserPasswordAuthenticationToken.java
Executable file → Normal file
9
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/TenantUserPasswordAuthenticationToken.java
Executable file → Normal file
@@ -16,22 +16,19 @@ import org.springframework.security.core.GrantedAuthority;
|
||||
/**
|
||||
* The authentication token which transports the username, password and the
|
||||
* tenant information for authentication.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TenantUserPasswordAuthenticationToken extends UsernamePasswordAuthenticationToken {
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
final Object tenant;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Creating a new {@link TenantUserPasswordAuthenticationToken} as
|
||||
* {@link #isAuthenticated()} will return {@code false}.
|
||||
*
|
||||
@@ -51,7 +48,7 @@ public class TenantUserPasswordAuthenticationToken extends UsernamePasswordAuthe
|
||||
/**
|
||||
* Creating a new {@link TenantUserPasswordAuthenticationToken} as
|
||||
* {@link #isAuthenticated()} will return {@code true}.
|
||||
*
|
||||
*
|
||||
* @param tenant
|
||||
* the tenant to authenticate against
|
||||
* @param principal
|
||||
|
||||
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/UserAuthenticationFilter.java
Executable file → Normal file
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/UserAuthenticationFilter.java
Executable file → Normal file
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/UserPrincipal.java
Executable file → Normal file
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/im/authentication/UserPrincipal.java
Executable file → Normal file
8
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/DosFilter.java
Executable file → Normal file
8
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/DosFilter.java
Executable file → Normal file
@@ -98,7 +98,7 @@ public class DosFilter extends OncePerRequestFilter {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.springframework.web.filter.OncePerRequestFilter#doFilterInternal(
|
||||
* javax.servlet.http. HttpServletRequest,
|
||||
@@ -108,7 +108,7 @@ public class DosFilter extends OncePerRequestFilter {
|
||||
protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response,
|
||||
final FilterChain filterChain) throws ServletException, IOException {
|
||||
|
||||
boolean processChain = true;
|
||||
boolean processChain;
|
||||
|
||||
final String ip = IpUtil.getClientIpFromRequest(request, forwardHeader).getHost();
|
||||
if (checkIpFails(ip)) {
|
||||
@@ -147,11 +147,11 @@ public class DosFilter extends OncePerRequestFilter {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean checkIpFails(final String ip) {
|
||||
private static boolean checkIpFails(final String ip) {
|
||||
return ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip);
|
||||
}
|
||||
|
||||
private boolean handleMissingIpAddress(final HttpServletResponse response) {
|
||||
private static boolean handleMissingIpAddress(final HttpServletResponse response) {
|
||||
boolean processChain;
|
||||
LOG.error("Failed to get peer IP adress");
|
||||
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||
|
||||
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SecurityContextTenantAware.java
Executable file → Normal file
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SecurityContextTenantAware.java
Executable file → Normal file
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SecurityProperties.java
Executable file → Normal file
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SecurityProperties.java
Executable file → Normal file
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SecurityTokenGenerator.java
Executable file → Normal file
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SecurityTokenGenerator.java
Executable file → Normal file
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SpringSecurityAuditorAware.java
Executable file → Normal file
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/SpringSecurityAuditorAware.java
Executable file → Normal file
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/util/IpUtil.java
Executable file → Normal file
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/util/IpUtil.java
Executable file → Normal file
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/util/SPInfo.java
Executable file → Normal file
0
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/util/SPInfo.java
Executable file → Normal file
0
hawkbit-security-core/src/test/java/org/eclipse/hawkbit/ExcludePathAwareShallowETagFilterTest.java
Executable file → Normal file
0
hawkbit-security-core/src/test/java/org/eclipse/hawkbit/ExcludePathAwareShallowETagFilterTest.java
Executable file → Normal file
0
hawkbit-security-core/src/test/java/org/eclipse/hawkbit/security/SecurityTokenGeneratorTest.java
Executable file → Normal file
0
hawkbit-security-core/src/test/java/org/eclipse/hawkbit/security/SecurityTokenGeneratorTest.java
Executable file → Normal file
0
hawkbit-security-core/src/test/java/org/eclipse/hawkbit/util/IpUtilTest.java
Executable file → Normal file
0
hawkbit-security-core/src/test/java/org/eclipse/hawkbit/util/IpUtilTest.java
Executable file → Normal file
Reference in New Issue
Block a user