Class SessionsController


  • @RestController
    @RequestMapping(path="api/sessions",
                    produces="application/json")
    public class SessionsController
    extends java.lang.Object
    REST API for session info for the /dashboard endpoint.
    Since:
    6.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void bulkRevoke​(org.springframework.security.core.Authentication authentication, java.util.List<java.lang.String> tgts)
      Method to revoke all sessions by user.
      org.apereo.cas.mgmt.domain.SsoSessionResponse getSession​(java.lang.String user, org.springframework.security.core.Authentication authentication)
      Looks up SSO sessions in the CAS cluster based on the passed user id.
      org.apereo.cas.mgmt.domain.SsoSessionResponse getUserSession​(org.springframework.security.core.Authentication authentication)
      Retrieves the sessions of the logged in user.
      void revokeAll​(org.springframework.security.core.Authentication authentication)
      Method to revoke all sessions by user.
      void revokeSession​(java.lang.String tgt, java.lang.String user, org.springframework.security.core.Authentication authentication)
      Deletes a users sso session based on the passed tgt string.
      • Methods inherited from class java.lang.Object

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

      • SessionsController

        public SessionsController()
    • Method Detail

      • getUserSession

        @GetMapping
        public org.apereo.cas.mgmt.domain.SsoSessionResponse getUserSession​(org.springframework.security.core.Authentication authentication)
                                                                     throws java.lang.IllegalAccessException
        Retrieves the sessions of the logged in user.
        Parameters:
        authentication - - the user
        Returns:
        - SsoSessionResponse
        Throws:
        java.lang.IllegalAccessException - - insufficient permissions
      • getSession

        @GetMapping("{user}")
        public org.apereo.cas.mgmt.domain.SsoSessionResponse getSession​(@PathVariable
                                                                        java.lang.String user,
                                                                        org.springframework.security.core.Authentication authentication)
                                                                 throws java.lang.IllegalAccessException
        Looks up SSO sessions in the CAS cluster based on the passed user id.
        Parameters:
        user - - the user regexp query
        authentication - - the user
        Returns:
        - SsoSessionResponse
        Throws:
        java.lang.IllegalAccessException - - Illegal Access
      • revokeSession

        @DeleteMapping("{tgt}")
        public void revokeSession​(@PathVariable
                                  java.lang.String tgt,
                                  @RequestParam
                                  java.lang.String user,
                                  org.springframework.security.core.Authentication authentication)
                           throws java.lang.IllegalAccessException
        Deletes a users sso session based on the passed tgt string.
        Parameters:
        tgt - - th tgt id
        user - - the user searched for
        authentication - - the user
        Throws:
        java.lang.IllegalAccessException - - Illegal Access
      • revokeAll

        @GetMapping("revokeAll")
        @ResponseStatus(OK)
        public void revokeAll​(org.springframework.security.core.Authentication authentication)
        Method to revoke all sessions by user.
        Parameters:
        authentication - - the request
      • bulkRevoke

        @PostMapping("bulkRevoke")
        @ResponseStatus(OK)
        public void bulkRevoke​(org.springframework.security.core.Authentication authentication,
                               @RequestBody
                               java.util.List<java.lang.String> tgts)
        Method to revoke all sessions by user.
        Parameters:
        authentication - - the user
        tgts - - List of TGT ids to revoke