Package org.cyclos.impl.access
Interface SessionData
-
- All Superinterfaces:
DelegatingUserPrincipal,ProcessableForProxying,RoleContainer,UserPrincipal
- All Known Implementing Classes:
AbstractSessionData,AccessClientSessionData,DirectUserSessionData,GuestSessionData,OidcSessionData,ScriptSessionData,StatefulUserSessionData,StatelessUserSessionData,SystemSessionData,UserSessionData
public interface SessionData extends RoleContainer, DelegatingUserPrincipal, ProcessableForProxying
Contains data in a user session
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidcheckConsistency()Checks for consistency.ChannelgetAccessChannel()Returns the original channel (i.e the channel used to access Cyclos) this session is usingStringgetAccessChannelName()Returns the internal name of the original channel (i.e the channel used to access Cyclos) .Set<BasicGroup>getAccessibleBasicGroups()Returns the basic groups accessible by the current sessionOidcAccessTokengetAccessToken()Returns the OpenID Connect / OAuth2 access token for this sessionUserAuthVOgetAuthenticatedUser()Returns the user authentication data, or null if noneChannelgetChannel()Returns the current channel this session is usingChannelAccessAccessorgetChannelAccessAccessor()Returns the accessor for the access channel (i.e the original channel used to access Cyclos) access settings.StringgetChannelName()Returns the internal name of the current channel.ChannelSettingsAccessorgetChannelSettingsAccessor()Returns the accessor for the current channel (i.e the channel used to run the service method) general settings.ConfigurationAccessorgetConfiguration()Returns the configuration accessorGroupgetGroup()Returns the group of the authenticated user, if anyIdentityProvidergetIdentityProvider()Returns theIdentityProviderused for this session only if the user was authenticated using such mechanism.BasicUsergetLoggedBasicUser()Returns the authenticated basic user, or null if noneOperatorgetLoggedOperator()Returns the authenticated operator, or null if none or the logged is not an operatorUsergetLoggedUser()Returns the authenticated user, or null if noneNetworkgetNetwork()Returns the network this session is using, or null if as global system or administratorPingetPin()Returns thePinused for this session only if the user was authenticated using such mechanism.ProductsAccessorgetProducts()Returns the products accessordefault Class<?>getProxyClass()Returns the class used for proxiesStringgetRemoteAddress()Returns the remote address, of the client accessing the applicationRequestDatagetRequestData()Returns data about the calling request.SessiongetSession()Returns the session in case this session data performed a loginSessionDataSubjectIdgetSubjectId()Returns the subject idbooleanhasPermission(Permission permission)Returns whether the current user has the given permissiondefault booleanhasPermission(Permission... permissions)Returns whether the current user has any of the given the given permissions.booleanhasRequiredValue(Permission permission, Object value)Returns whether the current user has access to the given required value for the given permissiondefault <S extends SessionData>
voidifWraps(Class<S> type, Consumer<S> consumer)If wrapping anotherSessionDataof the given type, calls the consumer with the wrapped instancebooleanisAdminOf(BasicUser user)Returns whether the current user is an administrator of the given userbooleanisBrokerOf(BasicUser user)Returns whether the current user is a broker of the given userbooleanisGlobalAdminInNetwork()Returns whether a global admin OR a global restricted has switched to a network.booleanisGuest()Returns whether the current session represents a guestbooleanisLoggedIn()Returns whether the current session represents a userbooleanisManagerOf(BasicUser user)Returns whether the current user is a manager of the given user and is not the given user.booleanisMultiNetworkAdminInGlobalMode()Returns whether a global restricted has not switched to a network.booleanisOwnerOf(BasicUser operator)Returns whether current user is either the owner member of a given operator or as another alias operatordefault booleanisRest()Returns whether this session was initiated from a REST requestbooleanisScript()Returns whether this session is running under a scriptbooleanisSelf(BasicUser user)booleanisSystem()Returns whether the current session represents a system taskbooleanisTrusted()Returns whether this session should be considered trustedbooleanisVisible(EntityCheck<SimpleEntity> entityCheck, SimpleEntity entity)Returns whether the given entity is visible under the given entity checkbooleanmanages(BasicUser user)Returns whether the current user manages the given user.booleanrelatesTo(BasicUser user)Returns whether the current user is related to (is allowed to view) the given userSessionDataunwrap()Returns the underlyingSessionDataif the current one is a wrapper-
Methods inherited from interface org.cyclos.entities.users.DelegatingUserPrincipal
getDelegate, getPrincipal
-
Methods inherited from interface org.cyclos.entities.users.RoleContainer
isAdmin, isAliasOperator, isBroker, isGlobalAdmin, isMember, isMemberOnly, isNetworkAdmin, isOperator, isRestrictedOperator, isUserManager
-
Methods inherited from interface org.cyclos.entities.users.UserPrincipal
getAccessClient, getAccountType, getBasicUser, getCustomFieldValue, getMobilePhone, getPrincipalType, getToken, getTrustedDevice
-
-
-
-
Method Detail
-
checkConsistency
void checkConsistency() throws InvalidSessionDataExceptionChecks for consistency. Called before invoking a service method, as system- Throws:
InvalidSessionDataException
-
getAccessChannel
Channel getAccessChannel()
Returns the original channel (i.e the channel used to access Cyclos) this session is using
-
getAccessChannelName
String getAccessChannelName()
Returns the internal name of the original channel (i.e the channel used to access Cyclos) . Must be accessible outside transactions.
-
getAccessibleBasicGroups
Set<BasicGroup> getAccessibleBasicGroups()
Returns the basic groups accessible by the current session
-
getAccessToken
OidcAccessToken getAccessToken()
Returns the OpenID Connect / OAuth2 access token for this session
-
getAuthenticatedUser
UserAuthVO getAuthenticatedUser()
Returns the user authentication data, or null if none
-
getChannel
Channel getChannel()
Returns the current channel this session is using
-
getChannelAccessAccessor
ChannelAccessAccessor getChannelAccessAccessor()
Returns the accessor for the access channel (i.e the original channel used to access Cyclos) access settings. Always uses the user's own settings. For example, if a global administrator is switched to a network, will get his settings, from global mode.
-
getChannelName
String getChannelName()
Returns the internal name of the current channel. Must be accessible outside transactions.
-
getChannelSettingsAccessor
ChannelSettingsAccessor getChannelSettingsAccessor()
Returns the accessor for the current channel (i.e the channel used to run the service method) general settings. Always uses the current configuration settings. For example, if a global administrator is switched to a network, will get the settings for the network administrators.
-
getConfiguration
ConfigurationAccessor getConfiguration()
Returns the configuration accessor
-
getGroup
Group getGroup()
Returns the group of the authenticated user, if any
-
getIdentityProvider
IdentityProvider getIdentityProvider()
Returns theIdentityProviderused for this session only if the user was authenticated using such mechanism.
-
getLoggedBasicUser
BasicUser getLoggedBasicUser()
Returns the authenticated basic user, or null if none
-
getLoggedOperator
Operator getLoggedOperator()
Returns the authenticated operator, or null if none or the logged is not an operator
-
getLoggedUser
User getLoggedUser()
Returns the authenticated user, or null if none
-
getNetwork
Network getNetwork()
Returns the network this session is using, or null if as global system or administrator
-
getPin
Pin getPin()
Returns thePinused for this session only if the user was authenticated using such mechanism.
-
getProducts
ProductsAccessor getProducts()
Returns the products accessor
-
getProxyClass
default Class<?> getProxyClass()
Description copied from interface:ProcessableForProxyingReturns the class used for proxies- Specified by:
getProxyClassin interfaceProcessableForProxying
-
getRemoteAddress
String getRemoteAddress()
Returns the remote address, of the client accessing the application
-
getRequestData
RequestData getRequestData()
Returns data about the calling request. Must be accessible outside transactions.
-
getSession
Session getSession()
Returns the session in case this session data performed a login
-
getSubjectId
SessionDataSubjectId getSubjectId()
Returns the subject id
-
hasPermission
boolean hasPermission(Permission permission)
Returns whether the current user has the given permission
-
hasPermission
default boolean hasPermission(Permission... permissions)
Returns whether the current user has any of the given the given permissions. When no permission is given, true is returned.
-
hasRequiredValue
boolean hasRequiredValue(Permission permission, Object value)
Returns whether the current user has access to the given required value for the given permission
-
ifWraps
default <S extends SessionData> void ifWraps(Class<S> type, Consumer<S> consumer)
If wrapping anotherSessionDataof the given type, calls the consumer with the wrapped instance
-
isAdminOf
boolean isAdminOf(BasicUser user)
Returns whether the current user is an administrator of the given user
-
isBrokerOf
boolean isBrokerOf(BasicUser user)
Returns whether the current user is a broker of the given user
-
isGlobalAdminInNetwork
boolean isGlobalAdminInNetwork()
Returns whether a global admin OR a global restricted has switched to a network.
-
isGuest
boolean isGuest()
Returns whether the current session represents a guest
-
isLoggedIn
boolean isLoggedIn()
Returns whether the current session represents a user
-
isManagerOf
boolean isManagerOf(BasicUser user)
Returns whether the current user is a manager of the given user and is not the given user.
-
isMultiNetworkAdminInGlobalMode
boolean isMultiNetworkAdminInGlobalMode()
Returns whether a global restricted has not switched to a network.
-
isOwnerOf
boolean isOwnerOf(BasicUser operator)
Returns whether current user is either the owner member of a given operator or as another alias operator
-
isRest
default boolean isRest()
Returns whether this session was initiated from a REST request
-
isScript
boolean isScript()
Returns whether this session is running under a script
-
isSelf
boolean isSelf(BasicUser user)
-
isSystem
boolean isSystem()
Returns whether the current session represents a system task
-
isTrusted
boolean isTrusted()
Returns whether this session should be considered trusted
-
isVisible
boolean isVisible(EntityCheck<SimpleEntity> entityCheck, SimpleEntity entity)
Returns whether the given entity is visible under the given entity check
-
manages
boolean manages(BasicUser user)
Returns whether the current user manages the given user. If the logged user and the given one are the same user then it returns true.
-
relatesTo
boolean relatesTo(BasicUser user)
Returns whether the current user is related to (is allowed to view) the given user
-
unwrap
SessionData unwrap()
Returns the underlyingSessionDataif the current one is a wrapper
-
-