Fix code smells.

Signed-off-by: Marcel Mager (INST-IOT/ESB) <Marcel.Mager@bosch-si.com>
This commit is contained in:
Marcel Mager (INST-IOT/ESB)
2016-09-23 10:11:36 +02:00
parent 54c4c8c481
commit 7176f93ca4
3 changed files with 5 additions and 6 deletions

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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);
}