Package org.cyclos.impl.access
Class SessionDataFactory
- java.lang.Object
-
- org.cyclos.impl.access.SessionDataFactory
-
public class SessionDataFactory extends Object
Any session data must be obtained using this factory.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSessionDataFactory.DirectSessionDataBuilder
-
Constructor Summary
Constructors Constructor Description SessionDataFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SessionDataaccessClient(boolean forLogin, String channel, String token, RequestData data)static SessionDataFactory.DirectSessionDataBuilderdirect(BasicUser user)Returns a builder for a user session data with the username as principal, by default ignoring urgent situations.static SessionDataFactory.DirectSessionDataBuilderdirect(UserPrincipal principal)Returns a builder for a user session data with the given principal, by default ignoring urgent situations.static SessionDataguest(RequestData requestData, String channel)static SessionDataguest(RequestData requestData, String channel, String accessChannelName)static SessionDatainChannel(String channelName)Returns a newSessionDatainheriting the current invocation's session data but for the given channel.static SessionDataoidc(String accessToken, RequestData requestData)static SessionDatascript(boolean runAsSystem)static SessionDatascript(SessionData delegate, boolean runAsSystem)static SessionDatastateful(String sessionToken, String remoteAddress, RequestData requestData)static SessionDatastateful(Session session, RequestData requestData)static SessionDatastateless(boolean forLogin, boolean allowIfPwdExpired, String channelName, String principalType, String principal, String password, RequestData requestData)static SessionDatasystem()Returns aSystemSessionDatainheriting the current invocation's request data and channel.
If there is no currentInvocationContext, assumes a local request in the main channel.
This method is intended to gain system privileges when running in a network or in global mode.static SessionDatasystem(Network network)static SessionDatasystem(Network network, String channel)Returns aSystemSessionDatainheriting the current invocation's request data and channel.
This method is intended to switch to the given network and gain system privileges.
If the given network is null then it works same assystem().static SessionDatasystem(RequestData data)static SessionDatasystem(RequestData data, String channel)static SessionDatasystem(RequestData data, String channel, String accessChannel)static SessionDatauser(BasicUser user)Builds a session data for the given user, ignoring all urgent situationsstatic SessionDatauser(UserPrincipal principal)Builds a session data for the given user principal, ignoring all urgent situations
-
-
-
Method Detail
-
accessClient
public static SessionData accessClient(boolean forLogin, String channel, String token, RequestData data)
-
direct
public static SessionDataFactory.DirectSessionDataBuilder direct(BasicUser user)
Returns a builder for a user session data with the username as principal, by default ignoring urgent situations.
-
direct
public static SessionDataFactory.DirectSessionDataBuilder direct(UserPrincipal principal)
Returns a builder for a user session data with the given principal, by default ignoring urgent situations.
-
guest
public static SessionData guest(RequestData requestData, String channel)
-
guest
public static SessionData guest(RequestData requestData, String channel, String accessChannelName)
-
inChannel
public static SessionData inChannel(String channelName)
Returns a newSessionDatainheriting the current invocation's session data but for the given channel. If the channel is null or the current session is already for the given channel then just return the current one.
-
oidc
public static SessionData oidc(String accessToken, RequestData requestData)
-
script
public static SessionData script(boolean runAsSystem)
-
script
public static SessionData script(SessionData delegate, boolean runAsSystem)
-
stateful
public static SessionData stateful(Session session, RequestData requestData)
-
stateful
public static SessionData stateful(String sessionToken, String remoteAddress, RequestData requestData)
-
stateless
public static SessionData stateless(boolean forLogin, boolean allowIfPwdExpired, String channelName, String principalType, String principal, String password, RequestData requestData)
-
system
public static SessionData system()
Returns aSystemSessionDatainheriting the current invocation's request data and channel.
If there is no currentInvocationContext, assumes a local request in the main channel.
This method is intended to gain system privileges when running in a network or in global mode. If you want to switch to a network then usesystem(Network).
-
system
public static SessionData system(Network network) throws IllegalStateException
- Throws:
IllegalStateException- See Also:
system(Network, String)
-
system
public static SessionData system(Network network, String channel) throws IllegalStateException
Returns aSystemSessionDatainheriting the current invocation's request data and channel.
This method is intended to switch to the given network and gain system privileges.
If the given network is null then it works same assystem(). i.e just gaining systen privileges- Throws:
IllegalStateException- If there is no currentInvocationContextand the network is not null
-
system
public static SessionData system(RequestData data)
-
system
public static SessionData system(RequestData data, String channel)
-
system
public static SessionData system(RequestData data, String channel, String accessChannel)
-
user
public static SessionData user(BasicUser user)
Builds a session data for the given user, ignoring all urgent situations
-
user
public static SessionData user(UserPrincipal principal)
Builds a session data for the given user principal, ignoring all urgent situations
-
-