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:
Kai Zimmermann
2016-01-21 13:42:38 +01:00
parent fb9dfd204c
commit 64deaeea3c
813 changed files with 9787 additions and 4929 deletions

View 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 {
/**

View 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;
}

View 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

View 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());