|
@@ -43,7 +43,7 @@ public class CredentialProvider {
|
|
static final Logger LOG = LoggerFactory.getLogger(CredentialProvider.class);
|
|
static final Logger LOG = LoggerFactory.getLogger(CredentialProvider.class);
|
|
|
|
|
|
public CredentialProvider(String masterKey, String masterKeyLocation,
|
|
public CredentialProvider(String masterKey, String masterKeyLocation,
|
|
- boolean isMasterKeyPersisted) {
|
|
|
|
|
|
+ boolean isMasterKeyPersisted) throws AmbariException {
|
|
if (masterKeyLocation == null)
|
|
if (masterKeyLocation == null)
|
|
throw new IllegalArgumentException("Master key location needed for " +
|
|
throw new IllegalArgumentException("Master key location needed for " +
|
|
"Credential Provider initialization.");
|
|
"Credential Provider initialization.");
|
|
@@ -55,6 +55,9 @@ public class CredentialProvider {
|
|
masterKeyService = new MasterKeyServiceImpl(masterKeyLocation,
|
|
masterKeyService = new MasterKeyServiceImpl(masterKeyLocation,
|
|
isMasterKeyPersisted);
|
|
isMasterKeyPersisted);
|
|
}
|
|
}
|
|
|
|
+ if (!masterKeyService.isMasterKeyInitialized()) {
|
|
|
|
+ throw new AmbariException("Master key initialization failed.");
|
|
|
|
+ }
|
|
String storeDir = masterKeyLocation.substring(0,
|
|
String storeDir = masterKeyLocation.substring(0,
|
|
masterKeyLocation.indexOf(Configuration.MASTER_KEY_FILENAME_DEFAULT));
|
|
masterKeyLocation.indexOf(Configuration.MASTER_KEY_FILENAME_DEFAULT));
|
|
this.keystoreService = new CredentialStoreServiceImpl(storeDir);
|
|
this.keystoreService = new CredentialStoreServiceImpl(storeDir);
|