use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class ClientStorageProviderResource method getSimpleName.
/**
* Need this for admin console to display simple name of provider when displaying client detail
*
* KEYCLOAK-4328
*
* @param id
* @return
*/
@GET
@Path("{id}/name")
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public Map<String, String> getSimpleName(@PathParam("id") String id) {
auth.clients().requireList();
ComponentModel model = realm.getComponent(id);
if (model == null) {
throw new NotFoundException("Could not find component");
}
if (!model.getProviderType().equals(ClientStorageProvider.class.getName())) {
throw new NotFoundException("found, but not a ClientStorageProvider");
}
Map<String, String> data = new HashMap<>();
data.put("id", model.getId());
data.put("name", model.getName());
return data;
}
use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class ComponentResource method getComponent.
@GET
@Path("{id}")
@Produces(MediaType.APPLICATION_JSON)
@NoCache
public ComponentRepresentation getComponent(@PathParam("id") String id) {
auth.realm().requireViewRealm();
ComponentModel model = realm.getComponent(id);
if (model == null) {
throw new NotFoundException("Could not find component");
}
ComponentRepresentation rep = ModelToRepresentation.toRepresentation(session, model, false);
return rep;
}
use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class ComponentResource method getSubcomponentConfig.
/**
* List of subcomponent types that are available to configure for a particular parent component.
*
* @param parentId
* @param subtype
* @return
*/
@GET
@Path("{id}/sub-component-types")
@Produces(MediaType.APPLICATION_JSON)
@NoCache
public Stream<ComponentTypeRepresentation> getSubcomponentConfig(@PathParam("id") String parentId, @QueryParam("type") String subtype) {
auth.realm().requireViewRealm();
ComponentModel parent = realm.getComponent(parentId);
if (parent == null) {
throw new NotFoundException("Could not find parent component");
}
if (subtype == null) {
throw new BadRequestException("must specify a subtype");
}
Class<? extends Provider> providerClass;
try {
providerClass = (Class<? extends Provider>) Class.forName(subtype);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
return session.getKeycloakSessionFactory().getProviderFactoriesStream(providerClass).filter(ComponentFactory.class::isInstance).map(factory -> toComponentTypeRepresentation(factory, parent));
}
use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class IdentityProviderResource method getIdentityProvider.
/**
* Get the identity provider
*
* @return
*/
@GET
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public IdentityProviderRepresentation getIdentityProvider() {
this.auth.realm().requireViewIdentityProviders();
if (identityProviderModel == null) {
throw new javax.ws.rs.NotFoundException();
}
IdentityProviderRepresentation rep = ModelToRepresentation.toRepresentation(realm, this.identityProviderModel);
return StripSecretsUtils.strip(rep);
}
use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.
the class IdentityProviderResource method getMapperById.
/**
* Get mapper by id for the identity provider
*
* @param id
* @return
*/
@GET
@NoCache
@Path("mappers/{id}")
@Produces(MediaType.APPLICATION_JSON)
public IdentityProviderMapperRepresentation getMapperById(@PathParam("id") String id) {
this.auth.realm().requireViewIdentityProviders();
if (identityProviderModel == null) {
throw new javax.ws.rs.NotFoundException();
}
IdentityProviderMapperModel model = realm.getIdentityProviderMapperById(id);
if (model == null)
throw new NotFoundException("Model not found");
return ModelToRepresentation.toRepresentation(model);
}
Aggregations