Class AuthInfo

java.lang.Object
no.polaric.core.auth.AuthInfo

public class AuthInfo extends Object
Authorizations and service config for a given user session. This is instantiated on each request!! Instances of this class can be sent to the client in JSON format.
  • Field Details

    • USERSES_EXPIRE

      public static final int USERSES_EXPIRE
      See Also:
    • userid

      public String userid
    • groupid

      public String groupid
    • callsign

      public String callsign
    • servercall

      public String servercall
    • admin

      public boolean admin
    • operator

      public boolean operator
    • tagsAuth

      public String tagsAuth
    • services

      public String[] services
    • userses

      public AuthInfo.UserSessionInfo userses
    • group

      public Group group
  • Constructor Details

    • AuthInfo

      public AuthInfo(ServerConfig conf, User u, Group g)
      Constructor. Gets userid from a user profile on request and sets authorisations. called from AuthService for each request.
      Parameters:
      conf - Server config object
      u - User object (see User.java)
      g - Group object (see Group.java)
    • AuthInfo

      public AuthInfo(ServerConfig conf, org.pac4j.core.context.WebContext context)
      Constructor. Gets info from web context.
      Parameters:
      conf - SErver config object.
      context - Session context
  • Method Details

    • addService

      public static void addService(String srv)
    • setUserSesFactory

      public static void setUserSesFactory(AuthInfo.SesCreateFunc f)
    • setUserSesClose

      public static void setUserSesClose(AuthInfo.SesCloseFunc f)
    • init

      public static void init(ServerConfig conf, SesNotifier ws)
      Called by the application to register handlers for opening and closing sessions. Used when users log in or log out. A session (as defined here) is shared between logins by the same user-id. A session is opened at the first login and closed after the last logout. After a short delay. After a session is closed it is kept for some time before expired and removed. Default: 1 week. Callback-functions on the webserver are called when sessions are opened and closed. These can be specified (as lambda-functions) by the application program using WebServer class: onLogin() and onLogout(),
      Parameters:
      conf - Server config object.
      ws - Session notifier (for callback)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • login

      public boolean login()
      Return true if user is logged in.
    • isTrackerAllowed

      public boolean isTrackerAllowed(String tr, String chan)
    • getSessionProfile

      public static Optional<org.pac4j.core.profile.CommonProfile> getSessionProfile(io.javalin.http.Context ctx)
    • getSessionProfile

      public static Optional<org.pac4j.core.profile.CommonProfile> getSessionProfile(org.pac4j.core.context.WebContext context)
    • authorize

      public void authorize(User u, Group grp)
      Authorizations. We use a kind a role-based authorization here. where some authorizations depends on role/group membership.
    • getUserses

      public AuthInfo.UserSessionInfo getUserses()
      Get the user's session info. Note that there may be multiple login sessions for the same user sharing the info.