Class ScopesResource

java.lang.Object
io.jans.configapi.core.rest.BaseResource
io.jans.configapi.rest.resource.auth.ConfigBaseResource
io.jans.configapi.rest.resource.auth.ScopesResource

@Path("/scopes") @Produces("application/json") @Consumes("application/json") public class ScopesResource extends ConfigBaseResource
Configures both OpenID Connect and UMA scopes.
Author:
Mougang T.Gasmyr
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    jakarta.ws.rs.core.Response
    createOpenidScope(@Valid io.jans.as.persistence.model.Scope scope)
    Create a new Scope resource and persist it.
    jakarta.ws.rs.core.Response
    deleteScope(@NotNull String inum)
    Delete the scope identified by the given inum.
    jakarta.ws.rs.core.Response
    getScopeByClientId(@NotNull String creatorId)
    Retrieves all scopes created by the given creator id.
    jakarta.ws.rs.core.Response
    getScopeById(@NotNull String inum, boolean withAssociatedClients)
    Retrieve a scope by its inum.
    jakarta.ws.rs.core.Response
    getScopeByType(@NotNull String type)
    Retrieves scopes that match the specified scope type.
    jakarta.ws.rs.core.Response
    getScopes(String type, int limit, String pattern, int startIndex, String sortBy, String sortOrder, boolean withAssociatedClients, String fieldValuePair)
    Retrieve a paged list of scopes matching the provided search, sorting, and paging criteria.
    jakarta.ws.rs.core.Response
    patchScope(@NotNull String inum, @NotNull String pathString)
    Apply a JSON Patch document to an existing scope identified by `inum`.
    jakarta.ws.rs.core.Response
    updateScope(@Valid io.jans.as.persistence.model.Scope scope)
    Updates an existing scope and returns the updated representation.

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ScopesResource

      public ScopesResource()
  • Method Details

    • getScopes

      @GET public jakarta.ws.rs.core.Response getScopes(@DefaultValue("") @QueryParam("type") String type, @DefaultValue("50") @QueryParam("limit") int limit, @DefaultValue("") @QueryParam("pattern") String pattern, @DefaultValue("0") @QueryParam("startIndex") int startIndex, @DefaultValue("inum") @QueryParam("sortBy") String sortBy, @DefaultValue("ascending") @QueryParam("sortOrder") String sortOrder, @DefaultValue("false") @QueryParam("withAssociatedClients") boolean withAssociatedClients, @DefaultValue("") @QueryParam("fieldValuePair") String fieldValuePair)
      Retrieve a paged list of scopes matching the provided search, sorting, and paging criteria.
      Parameters:
      withAssociatedClients - if `true`, include clients associated with each returned scope
      fieldValuePair - a comma-separated "field=value" list to filter results (e.g. "scopeType=spontaneous,defaultScope=true")
      Returns:
      a Response whose entity is a PagedResult of CustomScope objects matching the query
    • getScopeById

      @GET @Path("{inum}") public jakarta.ws.rs.core.Response getScopeById(@NotNull @PathParam("inum") @NotNull String inum, @DefaultValue("false") @QueryParam("withAssociatedClients") boolean withAssociatedClients)
      Retrieve a scope by its inum. If `withAssociatedClients` is true, the returned scope will include associated client references.
      Parameters:
      inum - the unique inum identifier of the scope
      withAssociatedClients - when true, include associated client information in the returned scope
      Returns:
      a Response containing the matching CustomScope
    • getScopeByClientId

      @GET @Path("creator/{creatorId}") public jakarta.ws.rs.core.Response getScopeByClientId(@NotNull @PathParam("creatorId") @NotNull String creatorId)
      Retrieves all scopes created by the given creator id.
      Parameters:
      creatorId - Id of the scope creator; use the client's client_id for client creators or the user's user_id for user creators.
      Returns:
      a list of CustomScope objects created by the specified creator.
    • getScopeByType

      @GET @Path("type/{type}") public jakarta.ws.rs.core.Response getScopeByType(@NotNull @PathParam("type") @NotNull String type)
      Retrieves scopes that match the specified scope type.
      Parameters:
      type - the scope type to filter by (for example, "openid" or "oauth")
      Returns:
      a list of CustomScope objects that match the given type; an empty list if no matches are found
    • createOpenidScope

      @POST public jakarta.ws.rs.core.Response createOpenidScope(@Valid @Valid io.jans.as.persistence.model.Scope scope)
      Create a new Scope resource and persist it. The provided Scope will be assigned a generated inum and DN and persisted. If the scope's displayName is not provided it will be set to the scope id; if scopeType is not provided it defaults to OAUTH.
      Parameters:
      scope - the Scope to create; must have a non-null `id`
      Returns:
      the created Scope populated with its generated `inum` and `dn`
    • updateScope

      @PUT public jakarta.ws.rs.core.Response updateScope(@Valid @Valid io.jans.as.persistence.model.Scope scope)
      Updates an existing scope and returns the updated representation. If the provided Scope has a null scopeType, it will be set to ScopeType.OAUTH before persisting.
      Parameters:
      scope - the Scope to update; must include a valid inum that identifies an existing scope
      Returns:
      the updated Scope
    • patchScope

      @PATCH @Consumes("application/json-patch+json") @Path("{inum}") public jakarta.ws.rs.core.Response patchScope(@PathParam("inum") @NotNull @NotNull String inum, @NotNull @NotNull String pathString) throws com.github.fge.jsonpatch.JsonPatchException, IOException
      Apply a JSON Patch document to an existing scope identified by `inum`.
      Parameters:
      inum - the scope identifier
      pathString - a JSON Patch document (as a string) describing the modifications to apply
      Returns:
      the patched Scope
      Throws:
      com.github.fge.jsonpatch.JsonPatchException - if the patch document is invalid or cannot be applied
      IOException - if an I/O error occurs while processing the patch
    • deleteScope

      @DELETE @Path("{inum}") public jakarta.ws.rs.core.Response deleteScope(@PathParam("inum") @NotNull @NotNull String inum)
      Delete the scope identified by the given inum.
      Parameters:
      inum - the scope identifier
      Returns:
      HTTP 204 No Content response when the scope is successfully deleted