Class JwksResource


  • @Path("/config/jwks")
    @Produces("application/json")
    @Consumes("application/json")
    public class JwksResource
    extends ConfigBaseResource
    Author:
    Yuriy Zabrovarnyy
    • Constructor Summary

      Constructors 
      Constructor Description
      JwksResource()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      jakarta.ws.rs.core.Response deleteKey​(@NotNull String kid)
      Delete the JSON Web Key identified by its kid.
      jakarta.ws.rs.core.Response get()
      Retrieve the server's configured JSON Web Key Set (JWKS).
      jakarta.ws.rs.core.Response getKeyById​(@NotNull io.jans.as.model.jwk.JSONWebKey jwk)
      Add a new JSON Web Key (JWK) to the server's JWKS configuration.
      jakarta.ws.rs.core.Response getKeyById​(@NotNull String kid)
      Retrieve a JSON Web Key by its key identifier (kid).
      jakarta.ws.rs.core.Response patch​(@NotNull String kid, @NotNull String requestString)
      Patch a JSON Web Key identified by its kid.
      jakarta.ws.rs.core.Response patch​(String requestString)
      Apply a JSON Patch to the stored Web Keys configuration and persist the change.
      jakarta.ws.rs.core.Response put​(io.jans.as.model.config.WebKeysConfiguration webkeys)
      Replace the server's JSON Web Key Set (JWKS) with the provided configuration.
      • 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

      • JwksResource

        public JwksResource()
    • Method Detail

      • get

        @GET
        public jakarta.ws.rs.core.Response get()
        Retrieve the server's configured JSON Web Key Set (JWKS).
        Returns:
        the HTTP Response containing the JWKS as a JSON string in the response entity
      • put

        @PUT
        public jakarta.ws.rs.core.Response put​(io.jans.as.model.config.WebKeysConfiguration webkeys)
        Replace the server's JSON Web Key Set (JWKS) with the provided configuration. Replaces the existing web keys in the persisted configuration with the given WebKeysConfiguration and returns the updated JWKS as a JSON string.
        Parameters:
        webkeys - the new WebKeysConfiguration to store as the server's JWKS
        Returns:
        the updated JWKS serialized as a JSON string
      • patch

        @PATCH
        @Consumes("application/json-patch+json")
        public jakarta.ws.rs.core.Response patch​(String requestString)
                                          throws com.github.fge.jsonpatch.JsonPatchException,
                                                 IOException
        Apply a JSON Patch to the stored Web Keys configuration and persist the change.
        Parameters:
        requestString - the JSON Patch document (media type application/json-patch+json) as a string
        Returns:
        the updated WebKeysConfiguration serialized as a JSON string
        Throws:
        com.github.fge.jsonpatch.JsonPatchException - if the patch cannot be applied to the existing configuration
        IOException - if an I/O error occurs while processing the patch
      • getKeyById

        @POST
        @Path("/key")
        public jakarta.ws.rs.core.Response getKeyById​(@NotNull
                                                      @NotNull io.jans.as.model.jwk.JSONWebKey jwk)
        Add a new JSON Web Key (JWK) to the server's JWKS configuration.
        Parameters:
        jwk - the JSONWebKey to add
        Returns:
        the created JSONWebKey
        Throws:
        jakarta.ws.rs.NotAcceptableException - if a key with the same `kid` already exists
      • getKeyById

        @GET
        @Path("/{kid}")
        public jakarta.ws.rs.core.Response getKeyById​(@PathParam("kid") @NotNull
                                                      @NotNull String kid)
        Retrieve a JSON Web Key by its key identifier (kid).
        Parameters:
        kid - the key identifier (kid) to look up; must not be null
        Returns:
        the JSONWebKey with the given kid, or null if no matching key exists
      • patch

        @PATCH
        @Consumes("application/json-patch+json")
        @Path("/{kid}")
        public jakarta.ws.rs.core.Response patch​(@PathParam("kid") @NotNull
                                                 @NotNull String kid,
                                                 @NotNull
                                                 @NotNull String requestString)
                                          throws com.github.fge.jsonpatch.JsonPatchException,
                                                 IOException
        Patch a JSON Web Key identified by its kid.
        Parameters:
        kid - the unique identifier of the key to patch
        requestString - a JSON Patch document (application/json-patch+json) as a string
        Returns:
        the patched JSON Web Key
        Throws:
        com.github.fge.jsonpatch.JsonPatchException - if the JSON Patch cannot be applied to the existing key
        IOException - if an I/O error occurs while processing the patch
        jakarta.ws.rs.NotFoundException - if no key with the given kid exists
      • deleteKey

        @DELETE
        @Path("/{kid}")
        public jakarta.ws.rs.core.Response deleteKey​(@PathParam("kid") @NotNull
                                                     @NotNull String kid)
        Delete the JSON Web Key identified by its kid.
        Parameters:
        kid - the unique identifier of the key to delete
        Returns:
        a Response with HTTP 204 No Content when the key is successfully deleted
        Throws:
        jakarta.ws.rs.NotFoundException - if no key with the provided kid exists