Class SessionResource


  • @Path("/jans-auth-server/session")
    @Produces("application/json")
    @Consumes("application/json")
    public class SessionResource
    extends ConfigBaseResource
    • Constructor Summary

      Constructors 
      Constructor Description
      SessionResource()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      jakarta.ws.rs.core.Response deleteSessionBySid​(@NotNull String sid)
      Deletes the session identified by the given session identifier.
      jakarta.ws.rs.core.Response deleteUsersSession​(@NotNull String userDn)
      Revokes all active sessions for the specified user distinguished name (DN).
      jakarta.ws.rs.core.Response getAllSessions()
      Retrieve all sessions using the resource's default search, paging, and sorting parameters.
      jakarta.ws.rs.core.Response getSessionById​(@NotNull String sid)
      Retrieve the session corresponding to the provided session identifier.
      jakarta.ws.rs.core.Response searchSessionEntries​(int limit, String pattern, int startIndex, String sortBy, String sortOrder, String fieldValuePair)
      Searches sessions matching the provided criteria and returns a paged result.
      • 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

      • SessionResource

        public SessionResource()
    • Method Detail

      • getAllSessions

        @GET
        public jakarta.ws.rs.core.Response getAllSessions()
        Retrieve all sessions using the resource's default search, paging, and sorting parameters. This endpoint returns a paged listing of session entries built with the default start index, page size, and sort order defined by the service.
        Returns:
        a Response whose entity is a SessionPagedResult containing session entries and paging metadata
      • searchSessionEntries

        @GET
        @Path("/search")
        public jakarta.ws.rs.core.Response searchSessionEntries​(@DefaultValue("50") @QueryParam("limit")
                                                                int limit,
                                                                @DefaultValue("") @QueryParam("pattern")
                                                                String pattern,
                                                                @DefaultValue("0") @QueryParam("startIndex")
                                                                int startIndex,
                                                                @DefaultValue("jansId") @QueryParam("sortBy")
                                                                String sortBy,
                                                                @DefaultValue("ascending") @QueryParam("sortOrder")
                                                                String sortOrder,
                                                                @DefaultValue("") @QueryParam("fieldValuePair")
                                                                String fieldValuePair)
        Searches sessions matching the provided criteria and returns a paged result.
        Parameters:
        limit - max number of results to return
        pattern - filter pattern applied to session attributes
        startIndex - 1-based index of the first result to return
        sortBy - attribute used to order the returned results
        sortOrder - "ascending" or "descending" sort direction
        fieldValuePair - comma-separated field/value filters or comparisons (for example: "userDn=...,expirationDate>2025-09-25")
        Returns:
        HTTP 200 response containing a SessionPagedResult with the matching sessions
      • getSessionById

        @GET
        @Path("/sid/{sid}")
        public jakarta.ws.rs.core.Response getSessionById​(@PathParam("sid") @NotNull
                                                          @NotNull String sid)
        Retrieve the session corresponding to the provided session identifier.
        Parameters:
        sid - the session identifier (SID) to retrieve
        Returns:
        the SessionId corresponding to the provided SID
      • deleteUsersSession

        @DELETE
        @Path("/user/{userDn}")
        public jakarta.ws.rs.core.Response deleteUsersSession​(@PathParam("userDn") @NotNull
                                                              @NotNull String userDn)
        Revokes all active sessions for the specified user distinguished name (DN).
        Parameters:
        userDn - the user's distinguished name whose sessions will be revoked
        Returns:
        an empty Response with HTTP 200 OK when revocation is completed
      • deleteSessionBySid

        @DELETE
        @Path("/sid/{sid}")
        public jakarta.ws.rs.core.Response deleteSessionBySid​(@PathParam("sid") @NotNull
                                                              @NotNull String sid)
        Deletes the session identified by the given session identifier.
        Parameters:
        sid - the session identifier to revoke
        Returns:
        an HTTP response; on successful revocation returns 200 OK with an empty body