All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.camunda.bpm.extension.keycloak.KeycloakUserQuery Maven / Gradle / Ivy

There is a newer version: 7.22.0
Show newest version
package org.camunda.bpm.extension.keycloak;

import java.util.List;

import org.camunda.bpm.engine.identity.User;
import org.camunda.bpm.engine.identity.UserQuery;
import org.camunda.bpm.engine.impl.Page;
import org.camunda.bpm.engine.impl.UserQueryImpl;
import org.camunda.bpm.engine.impl.interceptor.CommandContext;
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor;

/**
 * Keycloak specific user query implementation.
 */
public class KeycloakUserQuery extends UserQueryImpl {

	private static final long serialVersionUID = 1L;

	public KeycloakUserQuery() {
		super();
	}

	public KeycloakUserQuery(CommandExecutor commandExecutor) {
		super(commandExecutor);
	}

	// execute queries /////////////////////////////////////////

	@Override
	public long executeCount(CommandContext commandContext) {
		final KeycloakIdentityProviderSession provider = getKeycloakIdentityProvider(commandContext);
		return provider.findUserCountByQueryCriteria(this);
	}

	@Override
	public List executeList(CommandContext commandContext, Page page) {
		final KeycloakIdentityProviderSession provider = getKeycloakIdentityProvider(commandContext);
		return provider.findUserByQueryCriteria(this);
	}

	protected KeycloakIdentityProviderSession getKeycloakIdentityProvider(CommandContext commandContext) {
		return (KeycloakIdentityProviderSession) commandContext.getReadOnlyIdentityProvider();
	}

	// unimplemented features //////////////////////////////////

	@Override
	public UserQuery memberOfTenant(String tenantId) {
		throw new UnsupportedOperationException("The Keycloak identity provider does currently not support tenant queries.");
	}

	@Override
	public UserQuery potentialStarter(String procDefId) {
		throw new UnsupportedOperationException("The Keycloak identity provider does currently not support potential starter queries.");
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy