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 the OpenID Connect client with the given 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 the provided client, ensures a clientId and client secret exist (encrypting the secret as needed), persists the client, and returns the persisted representation.
        Parameters:
        client - the Client to create; must include redirect URIs. If the client's clientId is absent, a new one will be generated and assigned.
        Returns:
        an HTTP 201 Created response containing the persisted Client. The presence and form of the `clientSecret` in the response are governed by the server's response policy/configuration.
        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 client identifier and base DN, encrypts a provided client secret before saving, and returns the stored client with claims restored and the client secret adjusted according to the configured response policy.

        Parameters:
        client - the Client object containing updated fields; must include the client's `clientId` and `redirectUris`
        Returns:
        the updated Client with claims restored and `clientSecret` adjusted according to response policy
        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 the OpenID Connect client with the given inum.
        Parameters:
        inum - the client identifier (inum) to patch
        jsonPatchString - the JSON Patch document as a string
        Returns:
        a Response containing the patched Client entity
        Throws:
        io.jans.util.security.StringEncrypter.EncryptionException - if encrypting a provided client secret fails
        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
      • 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