Class ClientsResource


  • @Path("/openid/clients")
    @Produces("application/json")
    @Consumes("application/json")
    @ApplicationScoped
    public class ClientsResource
    extends ConfigBaseResource
    Author:
    Mougang T.Gasmyr
    • Constructor Summary

      Constructors 
      Constructor Description
      ClientsResource()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      jakarta.ws.rs.core.Response createOpenIdConnect​(@Valid io.jans.as.common.model.registration.Client client)
      Create a new OpenID Connect client.
      jakarta.ws.rs.core.Response deleteClient​(@NotNull String inum)
      Delete the OpenID Connect client identified by the given inum.
      jakarta.ws.rs.core.Response getOpenIdClientByInum​(@NotNull String inum)
      Retrieve a specific OpenID Connect client by its Inum.
      jakarta.ws.rs.core.Response getOpenIdConnectClients​(int limit, String pattern, int startIndex, String sortBy, String sortOrder, String fieldValuePair)
      Retrieve a paged list of OpenID Connect clients matching the given search criteria.
      jakarta.ws.rs.core.Response patchClient​(@NotNull String inum, @NotNull String jsonPatchString)
      Apply a JSON Patch to an existing OpenID Connect client identified by its inum.
      jakarta.ws.rs.core.Response updateClient​(@Valid io.jans.as.common.model.registration.Client client)
      Update an existing OpenID Connect client.
      • 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
    • Constructor Detail

      • ClientsResource

        public ClientsResource()
    • Method Detail

      • getOpenIdConnectClients

        @GET
        public jakarta.ws.rs.core.Response getOpenIdConnectClients​(@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("") @QueryParam("fieldValuePair")
                                                                   String fieldValuePair)
                                                            throws io.jans.util.security.StringEncrypter.EncryptionException
        Retrieve a paged list of OpenID Connect clients matching the given search criteria.
        Parameters:
        limit - maximum number of results to return
        pattern - search pattern to filter clients
        startIndex - 1-based index of the first result to return
        sortBy - attribute used to sort results
        sortOrder - sorting direction; allowed values are "ascending" and "descending"
        fieldValuePair - comma-separated field=value pairs to further filter results (e.g. "applicationType=web,persistClientAuthorizations=true")
        Returns:
        HTTP 200 response whose entity is a PagedResult containing the matching clients
        Throws:
        io.jans.util.security.StringEncrypter.EncryptionException - if decrypting client secrets for the response fails
      • getOpenIdClientByInum

        @GET
        @Path("{inum}")
        public jakarta.ws.rs.core.Response getOpenIdClientByInum​(@PathParam("inum") @NotNull
                                                                 @NotNull String inum)
                                                          throws io.jans.util.security.StringEncrypter.EncryptionException
        Retrieve a specific OpenID Connect client by its Inum.
        Parameters:
        inum - the client's Inum (identifier)
        Returns:
        a Response whose entity is the requested Client and whose status is 200 (OK)
        Throws:
        io.jans.util.security.StringEncrypter.EncryptionException
      • createOpenIdConnect

        @POST
        public jakarta.ws.rs.core.Response createOpenIdConnect​(@Valid
                                                               @Valid io.jans.as.common.model.registration.Client client)
                                                        throws io.jans.util.security.StringEncrypter.EncryptionException
        Create a new OpenID Connect client. Validates redirect URIs, scopes, and claims; generates a clientId if missing; ensures a client secret exists (generating one when omitted) and stores it encrypted; sets the client's DN and deletable flag, and persists the client.
        Parameters:
        client - the Client to create; must include redirect URIs. If clientId is absent, a new inum will be generated and assigned.
        Returns:
        an HTTP 201 Created response containing the created Client with its clientSecret decrypted and the original claims preserved.
        Throws:
        io.jans.util.security.StringEncrypter.EncryptionException - if encryption or decryption of the client secret fails.
      • updateClient

        @PUT
        public jakarta.ws.rs.core.Response updateClient​(@Valid
                                                        @Valid io.jans.as.common.model.registration.Client client)
                                                 throws io.jans.util.security.StringEncrypter.EncryptionException
        Update an existing OpenID Connect client.

        Validates scopes and claims, preserves the existing clientId and base DN, encrypts a provided client secret before persistence, and returns the stored client with the client secret decrypted and claims restored for the response.

        Parameters:
        client - the Client object containing updated fields; must include the client's `clientId` and `redirectUris`
        Returns:
        the updated Client with decrypted `clientSecret` and restored `claims`
        Throws:
        io.jans.util.security.StringEncrypter.EncryptionException - if encryption or decryption of the client secret fails
      • patchClient

        @PATCH
        @Consumes("application/json-patch+json")
        @Path("{inum}")
        public jakarta.ws.rs.core.Response patchClient​(@PathParam("inum") @NotNull
                                                       @NotNull String inum,
                                                       @NotNull
                                                       @NotNull String jsonPatchString)
                                                throws io.jans.util.security.StringEncrypter.EncryptionException,
                                                       com.github.fge.jsonpatch.JsonPatchException,
                                                       IOException
        Apply a JSON Patch to an existing OpenID Connect client identified by its inum.
        Parameters:
        inum - the client identifier (inum)
        jsonPatchString - the JSON Patch document as a string
        Returns:
        a Response containing the patched Client and an HTTP 200 status
        Throws:
        com.github.fge.jsonpatch.JsonPatchException - if the patch cannot be applied to the client
        IOException - if an I/O error occurs while processing the patch
        io.jans.util.security.StringEncrypter.EncryptionException
      • deleteClient

        @DELETE
        @Path("{inum}")
        public jakarta.ws.rs.core.Response deleteClient​(@PathParam("inum") @NotNull
                                                        @NotNull String inum)
        Delete the OpenID Connect client identified by the given inum. Validates that the client exists and removes it from storage.
        Parameters:
        inum - the client identifier (inum) of the client to delete
        Returns:
        a 204 No Content response on successful deletion