Search in sources :

Example 16 with NoCache

use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.

the class ServerInfoAdminResource method getInfo.

/**
 * Get themes, social providers, auth providers, and event listeners available on this server
 *
 * @return
 */
@GET
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public ServerInfoRepresentation getInfo() {
    ServerInfoRepresentation info = new ServerInfoRepresentation();
    info.setSystemInfo(SystemInfoRepresentation.create(session.getKeycloakSessionFactory().getServerStartupTimestamp()));
    info.setMemoryInfo(MemoryInfoRepresentation.create());
    info.setProfileInfo(ProfileInfoRepresentation.create());
    setSocialProviders(info);
    setIdentityProviders(info);
    setThemes(info);
    setProviders(info);
    setProtocolMapperTypes(info);
    setBuiltinProtocolMappers(info);
    setClientInstallations(info);
    setPasswordPolicies(info);
    info.setEnums(ENUMS);
    return info;
}
Also used : ServerInfoRepresentation(org.keycloak.representations.info.ServerInfoRepresentation) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) NoCache(org.jboss.resteasy.annotations.cache.NoCache)

Example 17 with NoCache

use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.

the class IdentityProvidersResource method getIdentityProviders.

/**
 * Get identity providers
 *
 * @param providerId Provider id
 * @return
 */
@Path("/providers/{provider_id}")
@GET
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public Response getIdentityProviders(@PathParam("provider_id") String providerId) {
    this.auth.realm().requireViewIdentityProviders();
    IdentityProviderFactory providerFactory = getProviderFactorytById(providerId);
    if (providerFactory != null) {
        return Response.ok(providerFactory).build();
    }
    return Response.status(BAD_REQUEST).build();
}
Also used : IdentityProviderFactory(org.keycloak.broker.provider.IdentityProviderFactory) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) NoCache(org.jboss.resteasy.annotations.cache.NoCache)

Example 18 with NoCache

use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.

the class ProtocolMappersResource method update.

/**
 * Update the mapper
 *
 * @param id Mapper id
 * @param rep
 */
@PUT
@NoCache
@Path("models/{id}")
@Consumes(MediaType.APPLICATION_JSON)
public void update(@PathParam("id") String id, ProtocolMapperRepresentation rep) {
    managePermission.require();
    ProtocolMapperModel model = client.getProtocolMapperById(id);
    if (model == null)
        throw new NotFoundException("Model not found");
    model = RepresentationToModel.toModel(rep);
    validateModel(model);
    client.updateProtocolMapper(model);
    adminEvent.operation(OperationType.UPDATE).resourcePath(session.getContext().getUri()).representation(rep).success();
}
Also used : NotFoundException(javax.ws.rs.NotFoundException) ProtocolMapperModel(org.keycloak.models.ProtocolMapperModel) Path(javax.ws.rs.Path) Consumes(javax.ws.rs.Consumes) NoCache(org.jboss.resteasy.annotations.cache.NoCache) PUT(javax.ws.rs.PUT)

Example 19 with NoCache

use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.

the class RoleByIdResource method getRealmRoleComposites.

/**
 * Get realm-level roles that are in the role's composite
 *
 * @param id
 * @return
 */
@Path("{role-id}/composites/realm")
@GET
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public Stream<RoleRepresentation> getRealmRoleComposites(@PathParam("role-id") final String id) {
    RoleModel role = getRoleModel(id);
    auth.roles().requireView(role);
    return getRealmRoleComposites(role);
}
Also used : RoleModel(org.keycloak.models.RoleModel) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) NoCache(org.jboss.resteasy.annotations.cache.NoCache)

Example 20 with NoCache

use of org.jboss.resteasy.annotations.cache.NoCache in project keycloak by keycloak.

the class RoleByIdResource method getRole.

/**
 * Get a specific role's representation
 *
 * @param id id of role
 * @return
 */
@Path("{role-id}")
@GET
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public RoleRepresentation getRole(@PathParam("role-id") final String id) {
    RoleModel roleModel = getRoleModel(id);
    auth.roles().requireView(roleModel);
    return getRole(roleModel);
}
Also used : RoleModel(org.keycloak.models.RoleModel) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) NoCache(org.jboss.resteasy.annotations.cache.NoCache)

Aggregations

NoCache (org.jboss.resteasy.annotations.cache.NoCache)152 Path (javax.ws.rs.Path)128 Produces (javax.ws.rs.Produces)100 GET (javax.ws.rs.GET)82 NotFoundException (javax.ws.rs.NotFoundException)67 POST (javax.ws.rs.POST)49 Consumes (javax.ws.rs.Consumes)48 PUT (javax.ws.rs.PUT)24 DELETE (javax.ws.rs.DELETE)23 HashMap (java.util.HashMap)20 RoleModel (org.keycloak.models.RoleModel)18 UserModel (org.keycloak.models.UserModel)18 BadRequestException (javax.ws.rs.BadRequestException)17 Response (javax.ws.rs.core.Response)16 ErrorResponseException (org.keycloak.services.ErrorResponseException)16 ClientModel (org.keycloak.models.ClientModel)15 AuthenticationFlowModel (org.keycloak.models.AuthenticationFlowModel)14 RealmModel (org.keycloak.models.RealmModel)14 List (java.util.List)12 Map (java.util.Map)12