Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.apache.polaris.core.entity.PolarisEntityConstants;
import org.apache.polaris.core.entity.PolarisEntitySubType;
import org.apache.polaris.core.entity.PolarisEntityType;
import org.apache.polaris.core.entity.PolarisPrincipalSecrets;
import org.apache.polaris.core.persistence.bootstrap.RootCredentialsSet;
import org.apache.polaris.core.persistence.cache.EntityCache;
import org.apache.polaris.core.persistence.dao.entity.BaseResult;
Expand Down Expand Up @@ -237,22 +236,11 @@ private PrincipalSecretsResult bootstrapServiceAndCreatePolarisPrincipalForRealm
PolarisEntityType.PRINCIPAL,
PolarisEntitySubType.NULL_SUBTYPE,
PolarisEntityConstants.getRootPrincipalName());
PolarisPrincipalSecrets secrets =
metaStoreManager
.loadPrincipalSecrets(
polarisContext,
PolarisEntity.of(rootPrincipalLookup.getEntity())
.getInternalPropertiesAsMap()
.get(PolarisEntityConstants.getClientIdPropertyName()))
.getPrincipalSecrets();
PrincipalSecretsResult rotatedSecrets =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little surprised no tests need to change for this to pass!

metaStoreManager.rotatePrincipalSecrets(
polarisContext,
secrets.getPrincipalClientId(),
secrets.getPrincipalId(),
false,
secrets.getMainSecretHash());
return rotatedSecrets;
return metaStoreManager.loadPrincipalSecrets(
polarisContext,
PolarisEntity.of(rootPrincipalLookup.getEntity())
.getInternalPropertiesAsMap()
.get(PolarisEntityConstants.getClientIdPropertyName()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public synchronized PolarisMetaStoreManager getOrCreateMetaStoreManager(
RealmContext realmContext) {
String realmId = realmContext.getRealmIdentifier();
if (!bootstrappedRealms.contains(realmId)) {
bootstrapRealmsAndPrintCredentials(List.of(realmId));
bootstrapRealmsFromEnvironment(List.of(realmId));
}
return super.getOrCreateMetaStoreManager(realmContext);
}
Expand All @@ -89,12 +89,12 @@ public synchronized Supplier<TransactionalPersistence> getOrCreateSessionSupplie
RealmContext realmContext) {
String realmId = realmContext.getRealmIdentifier();
if (!bootstrappedRealms.contains(realmId)) {
bootstrapRealmsAndPrintCredentials(List.of(realmId));
bootstrapRealmsFromEnvironment(List.of(realmId));
}
return super.getOrCreateSessionSupplier(realmContext);
}

private void bootstrapRealmsAndPrintCredentials(List<String> realms) {
private void bootstrapRealmsFromEnvironment(List<String> realms) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just renamed this method to better reflect its new purpose (it changed recently).

RootCredentialsSet rootCredentialsSet = RootCredentialsSet.fromEnvironment();
this.bootstrapRealms(realms, rootCredentialsSet);
}
Expand Down