Class TokenResource
- java.lang.Object
-
- io.jans.configapi.core.rest.BaseResource
-
- io.jans.configapi.rest.resource.auth.ConfigBaseResource
-
- io.jans.configapi.rest.resource.auth.TokenResource
-
@Path("/token") @Produces("application/json") @Consumes("application/json") @ApplicationScoped public class TokenResource extends ConfigBaseResource
-
-
Constructor Summary
Constructors Constructor Description TokenResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description jakarta.ws.rs.core.ResponsegetClientToken(@NotNull String clientId)Retrieves tokens associated with the specified client.jakarta.ws.rs.core.ResponsegetTokenById(@NotNull String tknCde)Retrieve a token by its code.jakarta.ws.rs.core.ResponserevokeClientToken(@NotNull String tknCde)Revoke a token identified by its token code.jakarta.ws.rs.core.ResponsesearchTokenEntries(int limit, String pattern, int startIndex, String sortBy, String sortOrder, String fieldValuePair)Search for tokens using pagination, sorting, and optional filtering criteria.-
Methods inherited from class io.jans.configapi.rest.resource.auth.ConfigBaseResource
getMaxCount
-
Methods inherited from class io.jans.configapi.core.rest.BaseResource
checkNotEmpty, checkNotEmpty, checkNotNull, checkNotNull, checkNotNull, checkResourceNotNull, createSearchRequest, findRootError, getBadRequestException, getBadRequestException, getBadRequestException, getHttpHeaders, getHttpRequest, getInternalServerException, getInternalServerException, getMissingAttributeError, getNotAcceptableException, getNotFoundError, getNotFoundError, getUriInfo, throwBadRequestException, throwBadRequestException, throwBadRequestException, throwInternalServerException, throwInternalServerException, throwInternalServerException, throwInternalServerException, throwMissingAttributeError, throwNotFoundException, throwNotFoundException
-
-
-
-
Method Detail
-
getTokenById
@GET @Path("/tknCde/{tknCde}") public jakarta.ws.rs.core.Response getTokenById(@PathParam("tknCde") @NotNull @NotNull String tknCde)Retrieve a token by its code. Validates the provided token code and returns the corresponding TokenEntity.- Parameters:
tknCde- the token identifier code to look up- Returns:
- a Response with status 200 containing the TokenEntity as JSON when found
- Throws:
javax.ws.rs.WebApplicationException- if no token exists for the given code (results in 404 Not Found)
-
getClientToken
@GET @Path("/client/{clientId}") public jakarta.ws.rs.core.Response getClientToken(@PathParam("clientId") @NotNull @NotNull String clientId)Retrieves tokens associated with the specified client.- Parameters:
clientId- the client's identifier (inum) used to filter tokens- Returns:
- a TokenEntityPagedResult containing the matching tokens and pagination metadata
-
searchTokenEntries
@GET @Path("/search") public jakarta.ws.rs.core.Response searchTokenEntries(@DefaultValue("50") @QueryParam("limit") int limit, @DefaultValue("") @QueryParam("pattern") String pattern, @DefaultValue("0") @QueryParam("startIndex") int startIndex, @DefaultValue("tknCde") @QueryParam("sortBy") String sortBy, @DefaultValue("ascending") @QueryParam("sortOrder") String sortOrder, @DefaultValue("") @QueryParam("fieldValuePair") String fieldValuePair)Search for tokens using pagination, sorting, and optional filtering criteria.- Parameters:
limit- maximum number of results to returnpattern- substring or pattern to match against token fieldsstartIndex- 1-based index of the first result to returnsortBy- attribute name to sort results by (e.g., token code)sortOrder- sort direction, either "ascending" or "descending"fieldValuePair- comma-separated field=value pairs to filter results (e.g., "grtTyp=client_credentials,tknTyp=access_token")- Returns:
- a Response whose entity is a TokenEntityPagedResult containing the matching tokens and pagination metadata
-
revokeClientToken
@DELETE @Path("/revoke/{tknCde}") public jakarta.ws.rs.core.Response revokeClientToken(@PathParam("tknCde") @NotNull @NotNull String tknCde)Revoke a token identified by its token code.- Parameters:
tknCde- the token code to revoke- Returns:
- an HTTP 204 No Content response when the token is successfully revoked
-
-