Not able to get custom provider from session

I have a custom UserStorageProvider that is all setup, registered in META-INF and working lovely :slight_smile:

public class MyFederationProvider implements UserStorageProvider, UserLookupProvider, CredentialInputValidator {

I’m trying to access this from a custom authenticator…

public class KeycloakUserUpdater extends AbstractSetRequiredActionAuthenticator {
    @Override
    public void authenticate(AuthenticationFlowContext context) {
        Set<?> allProviders = context.getSession().getAllProviders(UserStorageProvider.class);
        Set<?> allCustomerProviders = context.getSession().getAllProviders(MyFederationProvider.class);

When I debug this, allCustomProviders is size 0 and allProviders is size 1 but IntelliJ tells me that “All elements are null”.

How do I get my provder?

Found it.

The default create(KeycloakSession) method returns null.

I see where you tracked down the default of presumably the factory to return null on the create(Session) based method. Can I ask what you changed to allow for the provider to be created or returned? I am running into a similar situation.

Does your factory extend another class? And does the create method, on the super class, return null?

It does, I was debating just overriding that method, however did you have any issue not having the component model in that method? We have some configuration for the provider that comes from the model. If this is the only place the session only signature would be used its likely okay, so makes me a bit nervous

I implement UserStorageProviderFactory which does have the ComponentModel passed into the create method

T create(KeycloakSession var1, ComponentModel var2);

I do as well, however it appears the session based get provider method(s) use the factory create with just session signature