@@ -43,7 +43,7 @@ public class ControllerPreAuthenticatedSecurityHeaderFilterTest {
|
||||
@Mock
|
||||
private TenantSecurityToken tenantSecurityTokenMock;
|
||||
|
||||
private SecurityContextTenantAware tenantAware = new SecurityContextTenantAware();
|
||||
private final SecurityContextTenantAware tenantAware = new SecurityContextTenantAware();
|
||||
|
||||
private static final String CA_COMMON_NAME = "ca-cn";
|
||||
private static final String CA_COMMON_NAME_VALUE = "box1";
|
||||
@@ -57,16 +57,15 @@ public class ControllerPreAuthenticatedSecurityHeaderFilterTest {
|
||||
private static final String MULTI_HASH = "hash1;hash2;hash3";
|
||||
|
||||
private static final TenantConfigurationValue<String> CONFIG_VALUE_SINGLE_HASH = TenantConfigurationValue
|
||||
.<String>builder().value(SINGLE_HASH).build();
|
||||
.<String> builder().value(SINGLE_HASH).build();
|
||||
|
||||
private static final TenantConfigurationValue<String> CONFIG_VALUE_MULTI_HASH = TenantConfigurationValue
|
||||
.<String>builder().value(MULTI_HASH).build();
|
||||
.<String> builder().value(MULTI_HASH).build();
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
underTest = new ControllerPreAuthenticatedSecurityHeaderFilter(CA_COMMON_NAME, "X-Ssl-Issuer-Hash-%d",
|
||||
tenantConfigurationManagementMock,
|
||||
tenantAware, new SystemSecurityContext(tenantAware));
|
||||
tenantConfigurationManagementMock, tenantAware, new SystemSecurityContext(tenantAware));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -120,8 +119,8 @@ public class ControllerPreAuthenticatedSecurityHeaderFilterTest {
|
||||
final Collection<HeaderAuthentication> credentials2 = (Collection<HeaderAuthentication>) underTest
|
||||
.getPreAuthenticatedCredentials(securityToken2);
|
||||
|
||||
Object principal1 = underTest.getPreAuthenticatedPrincipal(securityToken1);
|
||||
Object principal2 = underTest.getPreAuthenticatedPrincipal(securityToken2);
|
||||
final Object principal1 = underTest.getPreAuthenticatedPrincipal(securityToken1);
|
||||
final Object principal2 = underTest.getPreAuthenticatedPrincipal(securityToken2);
|
||||
|
||||
assertThat(credentials1.contains(expected1)).isTrue();
|
||||
assertThat(credentials2.contains(expected2)).isTrue();
|
||||
@@ -131,11 +130,11 @@ public class ControllerPreAuthenticatedSecurityHeaderFilterTest {
|
||||
|
||||
}
|
||||
|
||||
private static TenantSecurityToken prepareSecurityToken(String issuerHashHeaderValue) {
|
||||
private static TenantSecurityToken prepareSecurityToken(final String issuerHashHeaderValue) {
|
||||
final TenantSecurityToken securityToken = new TenantSecurityToken("DEFAULT", CA_COMMON_NAME_VALUE,
|
||||
FileResource.createFileResourceBySha1("12345"));
|
||||
securityToken.getHeaders().put(CA_COMMON_NAME, CA_COMMON_NAME_VALUE);
|
||||
securityToken.getHeaders().put(X_SSL_ISSUER_HASH_1, issuerHashHeaderValue);
|
||||
securityToken.putHeader(CA_COMMON_NAME, CA_COMMON_NAME_VALUE);
|
||||
securityToken.putHeader(X_SSL_ISSUER_HASH_1, issuerHashHeaderValue);
|
||||
return securityToken;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user