Package no.polaric.core.auth
Class AuthInfo
java.lang.Object
no.polaric.core.auth.AuthInfo
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static interface
static class
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAuthInfo
(ServerConfig conf, User u, Group g) Constructor.AuthInfo
(ServerConfig conf, org.pac4j.core.context.WebContext context) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addService
(String srv) void
Authorizations.static Optional<org.pac4j.core.profile.CommonProfile>
getSessionProfile
(io.javalin.http.Context ctx) static Optional<org.pac4j.core.profile.CommonProfile>
getSessionProfile
(org.pac4j.core.context.WebContext context) Get the user's session info.static void
init
(ServerConfig conf, SesNotifier ws) Called by the application to register handlers for opening and closing sessions.boolean
isTrackerAllowed
(String tr, String chan) boolean
login()
Return true if user is logged in.static void
static void
toString()
-
Field Details
-
USERSES_EXPIRE
public static final int USERSES_EXPIRE- See Also:
-
userid
-
groupid
-
callsign
-
servercall
-
admin
public boolean admin -
operator
public boolean operator -
tagsAuth
-
services
-
userses
-
group
-
-
Constructor Details
-
AuthInfo
Constructor. Gets userid from a user profile on request and sets authorisations. called from AuthService for each request.- Parameters:
conf
- Server config objectu
- User object (see User.java)g
- Group object (see Group.java)
-
AuthInfo
Constructor. Gets info from web context.- Parameters:
conf
- SErver config object.context
- Session context
-
-
Method Details
-
addService
-
setUserSesFactory
-
setUserSesClose
-
init
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
-
login
public boolean login()Return true if user is logged in. -
isTrackerAllowed
-
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
Authorizations. We use a kind a role-based authorization here. where some authorizations depends on role/group membership. -
getUserses
Get the user's session info. Note that there may be multiple login sessions for the same user sharing the info.
-