Skip to content

Commit 9c667e4

Browse files
committed
Revert the changes for padding test config
Signed-off-by: Ryan Liang <jiallian@amazon.com>
1 parent 1004595 commit 9c667e4

1 file changed

Lines changed: 13 additions & 19 deletions

File tree

src/test/java/com/amazon/dlic/auth/http/saml/HTTPSamlAuthenticatorTest.java

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import java.io.FileInputStream;
1515
import java.io.IOException;
1616
import java.io.InputStream;
17-
import java.nio.charset.StandardCharsets;
1817
import java.security.KeyStore;
1918
import java.security.KeyStoreException;
2019
import java.security.NoSuchAlgorithmException;
@@ -34,7 +33,6 @@
3433

3534
import com.fasterxml.jackson.core.type.TypeReference;
3635
import com.google.common.collect.ImmutableMap;
37-
import com.google.common.io.BaseEncoding;
3836
import com.nimbusds.jwt.SignedJWT;
3937
import org.hamcrest.Matchers;
4038
import org.junit.After;
@@ -107,10 +105,6 @@ public class HTTPSamlAuthenticatorTest {
107105
private static X509Certificate spSigningCertificate;
108106
private static PrivateKey spSigningPrivateKey;
109107

110-
final static String signingKey =
111-
"This is my super safe signing key that no one will ever be able to guess. It's would take billions of years and the world's most powerful quantum computer to crack";
112-
final static String signingKeyB64Encoded = BaseEncoding.base64().encode(signingKey.getBytes(StandardCharsets.UTF_8));
113-
114108
@Before
115109
public void setUp() throws Exception {
116110
mockSamlIdpServer = new MockSamlIdpServer();
@@ -139,7 +133,7 @@ public void testRawHMACSettings() throws Exception {
139133
.put("idp.entity_id", mockSamlIdpServer.getIdpEntityId())
140134
.put("roles_key", "roles")
141135
.put("jwt.key.kty", "oct")
142-
.put("jwt.key.k", signingKeyB64Encoded)
136+
.put("jwt.key.k", "abc")
143137
.put("path.home", ".")
144138
.build();
145139

@@ -177,7 +171,7 @@ public void basicTest() throws Exception {
177171
.put(IDP_METADATA_URL, mockSamlIdpServer.getMetadataUri())
178172
.put("kibana_url", "http://wherever")
179173
.put("idp.entity_id", mockSamlIdpServer.getIdpEntityId())
180-
.put("exchange_key", signingKeyB64Encoded)
174+
.put("exchange_key", "abc")
181175
.put("roles_key", "roles")
182176
.put("path.home", ".")
183177
.build();
@@ -231,7 +225,7 @@ public void decryptAssertionsTest() throws Exception {
231225
"sp.signature_private_key",
232226
String.format(PRIVATE_KEY_PATTERN, Base64.getEncoder().encodeToString(spSigningPrivateKey.getEncoded()))
233227
)
234-
.put("exchange_key", signingKeyB64Encoded)
228+
.put("exchange_key", "abc")
235229
.put("roles_key", "roles")
236230
.put("path.home", ".")
237231
.build();
@@ -274,7 +268,7 @@ public void shouldUnescapeSamlEntitiesTest() throws Exception {
274268
"sp.signature_private_key",
275269
String.format(PRIVATE_KEY_PATTERN, Base64.getEncoder().encodeToString(spSigningPrivateKey.getEncoded()))
276270
)
277-
.put("exchange_key", signingKeyB64Encoded)
271+
.put("exchange_key", "abc")
278272
.put("roles_key", "roles")
279273
.put("path.home", ".")
280274
.build();
@@ -320,7 +314,7 @@ public void shouldUnescapeSamlEntitiesTest2() throws Exception {
320314
"sp.signature_private_key",
321315
String.format(PRIVATE_KEY_PATTERN, Base64.getEncoder().encodeToString(spSigningPrivateKey.getEncoded()))
322316
)
323-
.put("exchange_key", signingKeyB64Encoded)
317+
.put("exchange_key", "abc")
324318
.put("roles_key", "roles")
325319
.put("path.home", ".")
326320
.build();
@@ -365,7 +359,7 @@ public void shouldNotEscapeSamlEntities() throws Exception {
365359
"sp.signature_private_key",
366360
String.format(PRIVATE_KEY_PATTERN, Base64.getEncoder().encodeToString(spSigningPrivateKey.getEncoded()))
367361
)
368-
.put("exchange_key", signingKeyB64Encoded)
362+
.put("exchange_key", "abc")
369363
.put("roles_key", "roles")
370364
.put("path.home", ".")
371365
.build();
@@ -410,7 +404,7 @@ public void shouldNotTrimWhitespaceInJwtRoles() throws Exception {
410404
"sp.signature_private_key",
411405
String.format(PRIVATE_KEY_PATTERN, Base64.getEncoder().encodeToString(spSigningPrivateKey.getEncoded()))
412406
)
413-
.put("exchange_key", signingKeyB64Encoded)
407+
.put("exchange_key", "abc")
414408
.put("roles_key", "roles")
415409
.put("path.home", ".")
416410
.build();
@@ -452,7 +446,7 @@ public void testMetadataBody() throws Exception {
452446
.put(IDP_METADATA_CONTENT, metadataBody)
453447
.put("kibana_url", "http://wherever")
454448
.put("idp.entity_id", mockSamlIdpServer.getIdpEntityId())
455-
.put("exchange_key", signingKeyB64Encoded)
449+
.put("exchange_key", "abc")
456450
.put("roles_key", "roles")
457451
.put("path.home", ".")
458452
.build();
@@ -510,7 +504,7 @@ public void unsolicitedSsoTest() throws Exception {
510504
.put(IDP_METADATA_URL, mockSamlIdpServer.getMetadataUri())
511505
.put("kibana_url", "http://wherever")
512506
.put("idp.entity_id", mockSamlIdpServer.getIdpEntityId())
513-
.put("exchange_key", signingKeyB64Encoded)
507+
.put("exchange_key", "abc")
514508
.put("roles_key", "roles")
515509
.put("path.home", ".")
516510
.build();
@@ -645,7 +639,7 @@ public void rolesTest() throws Exception {
645639
.put(IDP_METADATA_URL, mockSamlIdpServer.getMetadataUri())
646640
.put("kibana_url", "http://wherever")
647641
.put("idp.entity_id", mockSamlIdpServer.getIdpEntityId())
648-
.put("exchange_key", signingKeyB64Encoded)
642+
.put("exchange_key", "abc")
649643
.put("roles_key", "roles")
650644
.put("path.home", ".")
651645
.put("roles_seperator", ",")
@@ -688,7 +682,7 @@ public void idpEndpointWithQueryStringTest() throws Exception {
688682
.put(IDP_METADATA_URL, mockSamlIdpServer.getMetadataUri())
689683
.put("kibana_url", "http://wherever")
690684
.put("idp.entity_id", mockSamlIdpServer.getIdpEntityId())
691-
.put("exchange_key", signingKeyB64Encoded)
685+
.put("exchange_key", "abc")
692686
.put("roles_key", "roles")
693687
.put("path.home", ".")
694688
.build();
@@ -738,7 +732,7 @@ private void commaSeparatedRoles(final String rolesAsString, final Settings.Buil
738732
Settings settings = settingsBuilder.put(IDP_METADATA_URL, mockSamlIdpServer.getMetadataUri())
739733
.put("kibana_url", "http://wherever")
740734
.put("idp.entity_id", mockSamlIdpServer.getIdpEntityId())
741-
.put("exchange_key", signingKeyB64Encoded)
735+
.put("exchange_key", "abc")
742736
.put("roles_key", "roles")
743737
.put("path.home", ".")
744738
.build();
@@ -843,7 +837,7 @@ public void initialConnectionFailureTest() throws Exception {
843837
.put("idp.min_refresh_delay", 100)
844838
.put("kibana_url", "http://wherever")
845839
.put("idp.entity_id", mockSamlIdpServer.getIdpEntityId())
846-
.put("exchange_key", signingKeyB64Encoded)
840+
.put("exchange_key", "abc")
847841
.put("roles_key", "roles")
848842
.put("path.home", ".")
849843
.build();

0 commit comments

Comments
 (0)