Fix code smells.
Signed-off-by: Marcel Mager (INST-IOT/ESB) <Marcel.Mager@bosch-si.com>
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
package org.eclipse.hawkbit.security;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ public class PreAuthTokenSourceTrustAuthenticationProvider implements Authentica
|
||||
throw new BadCredentialsException("The provided principal and credentials are not match");
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
*
|
||||
* The credentials may either be of type HeaderAuthentication or of type
|
||||
* Collection<HeaderAuthentication> depending on the authentication mode in
|
||||
@@ -129,7 +129,7 @@ public class PreAuthTokenSourceTrustAuthenticationProvider implements Authentica
|
||||
* <code>false</code>
|
||||
*/
|
||||
private boolean calculateAuthenticationSuccess(Object principal, Object credentials, Object tokenDetails) {
|
||||
boolean successAuthentication = false;
|
||||
boolean successAuthentication = false;
|
||||
if (Collection.class.isAssignableFrom(credentials.getClass())) {
|
||||
final Collection<?> multiValueCredentials = (Collection<?>) credentials;
|
||||
if (multiValueCredentials.contains(principal)) {
|
||||
@@ -139,7 +139,7 @@ public class PreAuthTokenSourceTrustAuthenticationProvider implements Authentica
|
||||
successAuthentication = checkSourceIPAddressIfNeccessary(tokenDetails);
|
||||
}
|
||||
|
||||
return successAuthentication;
|
||||
return successAuthentication;
|
||||
}
|
||||
|
||||
private boolean checkSourceIPAddressIfNeccessary(final Object tokenDetails) {
|
||||
|
||||
@@ -126,7 +126,7 @@ public class ControllerPreAuthenticatedSecurityHeaderFilterTest {
|
||||
assertThat(credentials.contains(expected)).isTrue();
|
||||
|
||||
Object principal = underTest.getPreAuthenticatedPrincipal(securityToken);
|
||||
assertEquals(expected, principal);
|
||||
assertEquals("hash1 expected in principal!", expected, principal);
|
||||
|
||||
securityToken = prepareSecurityToken();
|
||||
securityToken.getHeaders().put(X_SSL_ISSUER_HASH_1, "hash2");
|
||||
@@ -135,7 +135,7 @@ public class ControllerPreAuthenticatedSecurityHeaderFilterTest {
|
||||
assertThat(credentials.contains(expected)).isTrue();
|
||||
|
||||
principal = underTest.getPreAuthenticatedPrincipal(securityToken);
|
||||
assertEquals(expected, principal);
|
||||
assertEquals("hash2 expected in principal!", expected, principal);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user