KEYCLOAK-17257 Fix NPEs when user storage doesn't implement the CredentialInputValidator interface

This commit is contained in:
Blake Smith 2021-03-04 02:49:12 -06:00 committed by GitHub
parent 23bfaef4bb
commit b122f31d2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -255,7 +255,7 @@ public class UserCredentialStoreManager extends AbstractStorageManager<UserStora
if (model == null || !model.isEnabled()) return UserStorageCredentialConfigured.USER_STORAGE_DISABLED; if (model == null || !model.isEnabled()) return UserStorageCredentialConfigured.USER_STORAGE_DISABLED;
CredentialInputValidator validator = getStorageProviderInstance(model, CredentialInputValidator.class); CredentialInputValidator validator = getStorageProviderInstance(model, CredentialInputValidator.class);
if (validator.supportsCredentialType(type) && validator.isConfiguredFor(realm, user, type)) { if (validator != null && validator.supportsCredentialType(type) && validator.isConfiguredFor(realm, user, type)) {
return UserStorageCredentialConfigured.CONFIGURED; return UserStorageCredentialConfigured.CONFIGURED;
} }
} }