Package org.cyclos.impl.access
Interface SessionHandler
-
public interface SessionHandlerHandler for user sessions, containing methods to manage them
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classSessionHandler.CreateSessionParametersstatic classSessionHandler.UserCheckResult
-
Field Summary
Fields Modifier and Type Field Description static StringATTR_CHANNELScript attribute: theChannela user is logging instatic StringATTR_PRINCIPALScript attribute: theUserPrincipalstatic StringATTR_QUERYScript attribute: theConnectedUserQuerystatic StringATTR_REMOTE_ADDRESSScript attribute: the remote address to which this session should be validstatic StringATTR_SESSION_PROPERTIESScript attribute: the updated session propertiesstatic StringATTR_SESSION_TIMEOUTScript attribute: theTimeIntervalthat should be used as timeoutstatic StringATTR_SESSION_TOKENScript attribute: the session tokenstatic StringATTR_TRUSTEDScript attribute: whether the login is performed from a valid trusted device or notstatic StringATTR_USERScript attribute: theBasicUser
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AccessClientcheckAccessClientAccess(boolean forLogin, Network network, String channelName, String remoteAddress, String accessClientToken)Checks the access for a user for a channel / network using the specified access client token.OidcAccessTokencheckOidcAccessToken(Network network, String remoteAddress, String accessToken)Checks the access for a user for a network using the specified OAuth2 / OpenID Connect access token.SessionHandler.UserCheckResultcheckUserAccess(boolean forLogin, boolean allowIfPasswordExpired, Network network, String channelName, String remoteAddress, UserLocatorVO locator, String password, Set<Group> allowedGroups)Checks the access for a user for a channel / networkvoidclearPinCreationToken(Session session)Removes the PIN creation token for the given session, if anyvoidconfirmLogin(String password)Confirms the login for the current sessionSessioncreate(SessionHandler.CreateSessionParameters params)Creates a new session according to the given session data and timeout.SessiongetIfValid(String remoteAddress, String sessionToken)Returns an active session by remote address and session token.StringgetPinCreationToken(Session session)Returns the token that can be used to create a device PIN without informing the current password / PIN.TimeIntervalgetSessionTimeout(Session session)Returns the timeout for a given sessionbooleaninvalidate(String remoteAddress, String sessionToken)Invalidates the session with the given token, under the given remote address, returning whether the sessions was actually invalidated.Sessionlogin(String channelName, String remoteAddress, TimeInterval customSessionTimeout, UserLocatorVO locator, String password, Set<Group> allowedGroups)Performs a login.intpurgeExpired()Purges all expired sessions.intremove(Collection<String> tokens)Removes (both from the shared map and from the database) sessions with the given tokens, returning the number of actually deleted sessionsbooleanremove(Session session)Removes (both from the shared map and from the database) the given session, returning true if was actually removedStringreplace(Session session)Replaces an existing session tokenvoidsetProperties(Session session, SessionProperties properties)Updates the properties of the given sessionvoidupdateTimeout(String sessionToken, TimeInterval interval)Updates the expiration time of the session with the given token
-
-
-
Field Detail
-
ATTR_USER
static final String ATTR_USER
Script attribute: theBasicUser- See Also:
- Constant Field Values
-
ATTR_PRINCIPAL
static final String ATTR_PRINCIPAL
Script attribute: theUserPrincipal- See Also:
- Constant Field Values
-
ATTR_TRUSTED
static final String ATTR_TRUSTED
Script attribute: whether the login is performed from a valid trusted device or not- See Also:
- Constant Field Values
-
ATTR_SESSION_TOKEN
static final String ATTR_SESSION_TOKEN
Script attribute: the session token- See Also:
- Constant Field Values
-
ATTR_SESSION_PROPERTIES
static final String ATTR_SESSION_PROPERTIES
Script attribute: the updated session properties- See Also:
- Constant Field Values
-
ATTR_CHANNEL
static final String ATTR_CHANNEL
Script attribute: theChannela user is logging in- See Also:
- Constant Field Values
-
ATTR_SESSION_TIMEOUT
static final String ATTR_SESSION_TIMEOUT
Script attribute: theTimeIntervalthat should be used as timeout- See Also:
- Constant Field Values
-
ATTR_REMOTE_ADDRESS
static final String ATTR_REMOTE_ADDRESS
Script attribute: the remote address to which this session should be valid- See Also:
- Constant Field Values
-
ATTR_QUERY
static final String ATTR_QUERY
Script attribute: theConnectedUserQuery- See Also:
- Constant Field Values
-
-
Method Detail
-
checkAccessClientAccess
AccessClient checkAccessClientAccess(boolean forLogin, Network network, String channelName, String remoteAddress, String accessClientToken)
Checks the access for a user for a channel / network using the specified access client token.
-
checkOidcAccessToken
OidcAccessToken checkOidcAccessToken(Network network, String remoteAddress, String accessToken)
Checks the access for a user for a network using the specified OAuth2 / OpenID Connect access token. The channel is alwaysBuiltInChannel.OIDC.
-
checkUserAccess
SessionHandler.UserCheckResult checkUserAccess(boolean forLogin, boolean allowIfPasswordExpired, Network network, String channelName, String remoteAddress, UserLocatorVO locator, String password, Set<Group> allowedGroups)
Checks the access for a user for a channel / network
-
clearPinCreationToken
void clearPinCreationToken(Session session)
Removes the PIN creation token for the given session, if any
-
confirmLogin
void confirmLogin(String password) throws FrameworkException
Confirms the login for the current session- Throws:
FrameworkException
-
create
Session create(SessionHandler.CreateSessionParameters params)
Creates a new session according to the given session data and timeout.
-
getIfValid
Session getIfValid(String remoteAddress, String sessionToken)
Returns an active session by remote address and session token. If the session has expired or doesn't match the remote address, returns null
-
getPinCreationToken
String getPinCreationToken(Session session)
Returns the token that can be used to create a device PIN without informing the current password / PIN. The token is valid for 6 hours since the session is created.
-
getSessionTimeout
TimeInterval getSessionTimeout(Session session)
Returns the timeout for a given session
-
invalidate
boolean invalidate(String remoteAddress, String sessionToken)
Invalidates the session with the given token, under the given remote address, returning whether the sessions was actually invalidated.
-
login
Session login(String channelName, String remoteAddress, TimeInterval customSessionTimeout, UserLocatorVO locator, String password, Set<Group> allowedGroups) throws FrameworkException, LoginException, RemoteAddressBlockedException
Performs a login. Checks the remote address blocking by exceeding invalid username attempts, and creates a session. When allowedGroups is null, allows any group to login. Otherwise, retrict login to users of these groups.
-
purgeExpired
int purgeExpired()
Purges all expired sessions. Should run outside a transaction.
-
remove
int remove(Collection<String> tokens)
Removes (both from the shared map and from the database) sessions with the given tokens, returning the number of actually deleted sessions
-
remove
boolean remove(Session session)
Removes (both from the shared map and from the database) the given session, returning true if was actually removed
-
setProperties
void setProperties(Session session, SessionProperties properties)
Updates the properties of the given session
-
updateTimeout
void updateTimeout(String sessionToken, TimeInterval interval)
Updates the expiration time of the session with the given token
-
-