mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-31 04:25:29 +00:00
fix(secret-service): fix default encrypt key (#7074)
This commit is contained in:
parent
e23eb7108f
commit
6d9da9b5e9
@ -44,7 +44,7 @@ telemetry:
|
|||||||
enabledServer: ${DATAHUB_TELEMETRY_ENABLED:true}
|
enabledServer: ${DATAHUB_TELEMETRY_ENABLED:true}
|
||||||
|
|
||||||
secretService:
|
secretService:
|
||||||
encryptionKey: "#{systemEnvironment['SECRET_SERVICE_ENCRYPTION_KEY']}:ENCRYPTION_KEY"
|
encryptionKey: "#{systemEnvironment['SECRET_SERVICE_ENCRYPTION_KEY'] ?: 'ENCRYPTION_KEY'}"
|
||||||
|
|
||||||
datahub:
|
datahub:
|
||||||
serverType: ${DATAHUB_SERVER_TYPE:prod}
|
serverType: ${DATAHUB_SERVER_TYPE:prod}
|
||||||
|
@ -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=");
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user