use of org.keycloak.testsuite.federation.UserMapStorageFactory in project keycloak by keycloak.
the class UserStorageTest method afterTestCleanUp.
@After
public void afterTestCleanUp() throws URISyntaxException, IOException {
testingClient.server().run(session -> {
RealmModel realm = session.realms().getRealmByName("test");
if (realm == null) {
return;
}
UserModel user = session.users().getUserByUsername(realm, "thor");
if (user != null) {
session.userLocalStorage().removeUser(realm, user);
session.userCache().clear();
}
// we need to clear userPasswords and userGroups from UserMapStorageFactory
UserMapStorageFactory userMapStorageFactory = (UserMapStorageFactory) session.getKeycloakSessionFactory().getProviderFactory(UserStorageProvider.class, UserMapStorageFactory.PROVIDER_ID);
Assert.assertNotNull(userMapStorageFactory);
userMapStorageFactory.clear();
});
}
Aggregations