Search in sources :

Example 1 with MapResourceServerEntity

use of org.keycloak.models.map.authorization.entity.MapResourceServerEntity in project keycloak by keycloak.

the class MapResourceServerStore method findById.

@Override
public ResourceServer findById(String id) {
    LOG.tracef("findById(%s)%s", id, getShortStackTrace());
    if (id == null) {
        return null;
    }
    MapResourceServerEntity entity = tx.read(id);
    return entityToAdapter(entity);
}
Also used : MapResourceServerEntity(org.keycloak.models.map.authorization.entity.MapResourceServerEntity)

Example 2 with MapResourceServerEntity

use of org.keycloak.models.map.authorization.entity.MapResourceServerEntity in project keycloak by keycloak.

the class MapResourceServerStore method create.

@Override
public ResourceServer create(ClientModel client) {
    String clientId = client.getId();
    LOG.tracef("create(%s)%s", clientId, getShortStackTrace());
    if (clientId == null)
        return null;
    if (!StorageId.isLocalStorage(clientId)) {
        throw new ModelException("Creating resource server from federated ClientModel not supported");
    }
    if (tx.read(clientId) != null) {
        throw new ModelDuplicateException("Resource server already exists: " + clientId);
    }
    MapResourceServerEntity entity = new MapResourceServerEntityImpl();
    entity.setId(clientId);
    return entityToAdapter(tx.create(entity));
}
Also used : MapResourceServerEntityImpl(org.keycloak.models.map.authorization.entity.MapResourceServerEntityImpl) ModelException(org.keycloak.models.ModelException) ModelDuplicateException(org.keycloak.models.ModelDuplicateException) MapResourceServerEntity(org.keycloak.models.map.authorization.entity.MapResourceServerEntity)

Aggregations

MapResourceServerEntity (org.keycloak.models.map.authorization.entity.MapResourceServerEntity)2 ModelDuplicateException (org.keycloak.models.ModelDuplicateException)1 ModelException (org.keycloak.models.ModelException)1 MapResourceServerEntityImpl (org.keycloak.models.map.authorization.entity.MapResourceServerEntityImpl)1