[keycloak-user] user storage provider (non-importing strategy) - examples causing Nullpointer-Exceptions

Matuszak, Eduard eduard.matuszak at worldline.com
Tue Jan 17 10:57:07 EST 2017


Hello

I am struggling to make the user storage provider examples run in Keycloak 2.5.0 Final: Taking the "old" imported strategy runs fine, but whether the user-storage-simple (readonly) nor the user-storage-jpa example succeeds to build up a complete login, crashing with Nullpointer-Exceptions. Perhaps you have a hint or can confirm that the examples are not running because of Keycloak's behaviour being solved in future?

Thanks in advance for any comment, Eduard Matuszak


For completion, the source code is attached




.. and these are the stack-traces:

user-storage-simple (readonly)
---------------------------------------
16:35:44,569 ERROR [org.keycloak.keys.FailsafeHmacKeyProvider] (default task-39) No active keys found, using failsafe provider, please login to admin console to add keys. Clustering is not supported.
16:35:44,569 WARN  [org.keycloak.keys.FailsafeHmacKeyProvider] (default task-39) Keys expired, re-generated kid=dbeb665e-c67f-4041-a2ac-4dfe6375d1e8
16:35:53,626 WARN  [org.keycloak.services] (default task-45) KC-SERVICES0013: Failed authentication: java.lang.NullPointerException
        at org.keycloak.credential.UserCredentialStoreManager.getStoredCredentialsByType(UserCredentialStoreManager.java:86)
        at org.keycloak.credential.PasswordCredentialProvider.onCache(PasswordCredentialProvider.java:215)
        at org.keycloak.credential.UserCredentialStoreManager.onCache(UserCredentialStoreManager.java:302)
        at org.keycloak.models.cache.infinispan.UserCacheSession.onCache(UserCacheSession.java:409)
        at org.keycloak.models.cache.infinispan.UserCacheSession.cacheUser(UserCacheSession.java:369)
        at org.keycloak.models.cache.infinispan.UserCacheSession.getUserAdapter(UserCacheSession.java:280)
        at org.keycloak.models.cache.infinispan.UserCacheSession.getUserByUsername(UserCacheSession.java:258)
        at org.keycloak.models.utils.KeycloakModelUtils.findUserByNameOrEmail(KeycloakModelUtils.java:205)
        at org.keycloak.authentication.authenticators.browser.AbstractUsernameFormAuthenticator.validateUserAndPassword(AbstractUsernameFormAuthenticator.java:133)
        at org.keycloak.authentication.authenticators.browser.UsernamePasswordForm.validateForm(UsernamePasswordForm.java:56)
        at org.keycloak.authentication.authenticators.browser.UsernamePasswordForm.action(UsernamePasswordForm.java:49)
        at org.keycloak.authentication.DefaultAuthenticationFlow.processAction(DefaultAuthenticationFlow.java:92)
        at org.keycloak.authentication.DefaultAuthenticationFlow.processAction(DefaultAuthenticationFlow.java:76)
        at org.keycloak.authentication.AuthenticationProcessor.authenticationAction(AuthenticationProcessor.java:759)
        at org.keycloak.services.resources.LoginActionsService.processFlow(LoginActionsService.java:365)
        at org.keycloak.services.resources.LoginActionsService.processAuthentication(LoginActionsService.java:347)
        at org.keycloak.services.resources.LoginActionsService.authenticateForm(LoginActionsService.java:401)
..


user-storage-jpa (adapted version)
-------------------------------------------
16:38:36,780 INFO  [org.ccp.provider.ccp_augmented_file.CcpAugmentedFileUserStorageProvider] (default task-45) getUserByUsername: adm_eduard
16:38:36,781 WARN  [org.keycloak.services] (default task-45) KC-SERVICES0013: Failed authentication: java.lang.NullPointerException
        at org.keycloak.storage.adapter.AbstractUserAdapterFederatedStorage.getFirstAttribute(AbstractUserAdapterFederatedStorage.java:359)
        at org.ccp.provider.ccp_augmented_file.UserAdapter.getFirstAttribute(UserAdapter.java:112)
        at org.keycloak.storage.adapter.AbstractUserAdapterFederatedStorage.getCreatedTimestamp(AbstractUserAdapterFederatedStorage.java:324)
        at org.keycloak.models.cache.infinispan.entities.CachedUser.<init>(CachedUser.java:55)
        at org.keycloak.models.cache.infinispan.UserCacheSession.cacheUser(UserCacheSession.java:342)
        at org.keycloak.models.cache.infinispan.UserCacheSession.getUserAdapter(UserCacheSession.java:280)
        at org.keycloak.models.cache.infinispan.UserCacheSession.getUserByUsername(UserCacheSession.java:258)
        at org.keycloak.models.utils.KeycloakModelUtils.findUserByNameOrEmail(KeycloakModelUtils.java:205)
        at org.keycloak.authentication.authenticators.browser.AbstractUsernameFormAuthenticator.validateUserAndPassword(AbstractUsernameFormAuthenticator.java:133)
        at org.keycloak.authentication.authenticators.browser.UsernamePasswordForm.validateForm(UsernamePasswordForm.java:56)
        at org.keycloak.authentication.authenticators.browser.UsernamePasswordForm.action(UsernamePasswordForm.java:49)
        at org.keycloak.authentication.DefaultAuthenticationFlow.processAction(DefaultAuthenticationFlow.java:92)
        at org.keycloak.authentication.DefaultAuthenticationFlow.processAction(DefaultAuthenticationFlow.java:76)
        at org.keycloak.authentication.AuthenticationProcessor.authenticationAction(AuthenticationProcessor.java:759)
        at org.keycloak.services.resources.LoginActionsService.processFlow(LoginActionsService.java:365)
        at org.keycloak.services.resources.LoginActionsService.processAuthentication(LoginActionsService.java:347)
        at org.keycloak.services.resources.LoginActionsService.authenticateForm(LoginActionsService.java:401)
..




More information about the keycloak-user mailing list