Search in sources :

Example 1 with MapResourceServerEntityImpl

use of org.keycloak.models.map.authorization.entity.MapResourceServerEntityImpl 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

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