-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(secret-service): fix default encrypt key (#7074)
- Loading branch information
1 parent
5951379
commit f14676f
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...ice/factories/src/test/java/com/linkedin/gms/factory/secret/SecretServiceFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.linkedin.gms.factory.secret; | ||
|
||
import com.linkedin.metadata.secret.SecretService; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.TestPropertySource; | ||
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; | ||
import org.testng.annotations.Test; | ||
|
||
import java.io.IOException; | ||
import java.nio.charset.StandardCharsets; | ||
|
||
import static org.testng.Assert.assertEquals; | ||
import static org.testng.Assert.assertNotNull; | ||
|
||
@TestPropertySource(locations = "classpath:/application.yml") | ||
@SpringBootTest(classes = {SecretServiceFactory.class}) | ||
public class SecretServiceFactoryTest extends AbstractTestNGSpringContextTests { | ||
|
||
@Value("${secretService.encryptionKey}") | ||
private String encryptionKey; | ||
|
||
@Autowired | ||
SecretService test; | ||
|
||
@Test | ||
void testInjection() throws IOException { | ||
assertEquals(encryptionKey, "ENCRYPTION_KEY"); | ||
assertNotNull(test); | ||
assertEquals(test.getHashedPassword("".getBytes(StandardCharsets.UTF_8), "password"), | ||
"XohImNooBHFR0OVvjcYpJ3NgPQ1qq73WKhHvch0VQtg="); | ||
} | ||
} |