@Component(value="cuba_Connection") @Scope(value="vaadin") public class ConnectionImpl extends java.lang.Object implements Connection
Connection implementation for web-client.Connection.StateChangeEvent, Connection.UserSubstitutedEvent| Modifier and Type | Field and Description |
|---|---|
protected AuthenticationService |
authenticationService |
protected BackgroundWorker |
backgroundWorker |
protected EventHub |
eventHub |
protected Events |
events |
protected GlobalConfig |
globalConfig |
protected java.util.List<LoginProvider> |
loginProviders |
protected Messages |
messages |
protected java.lang.String |
userRemoteAddress |
protected UserSessionService |
userSessionService |
NAME| Constructor and Description |
|---|
ConnectionImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addStateChangeListener(java.util.function.Consumer<Connection.StateChangeEvent> listener)
Add a connection listener.
|
void |
addUserSubstitutionListener(java.util.function.Consumer<Connection.UserSubstitutedEvent> listener)
Add a user substitution listener.
|
protected ClientUserSession |
createSession(UserSession userSession) |
protected java.util.TimeZone |
detectTimeZone() |
protected void |
fireStateChangeListeners(UserSession previousSession,
UserSession newSession) |
protected void |
fireSubstitutionListeners() |
protected java.util.List<LoginProvider> |
getProviders() |
UserSession |
getSession()
Get current user session.
|
protected ClientUserSession |
getSessionInternal() |
protected java.lang.String |
getUserRemoteAddress() |
protected com.vaadin.server.WebBrowser |
getWebBrowserDetails() |
protected void |
init() |
boolean |
isAlive()
Check if session is alive on middleware
|
boolean |
isAuthenticated()
Check if the client was authenticated.
|
boolean |
isConnected()
Check if the client is connected to the middleware.
|
void |
login(Credentials credentials)
Authenticates a user, starts session and changes state of the connection.
|
protected AuthenticationDetails |
loginInternal(Credentials credentials) |
void |
logout()
Log out of the system.
|
protected java.lang.String |
makeClientInfo() |
protected void |
preprocessCredentials(Credentials credentials) |
protected void |
publishAfterLoginEvent(Credentials credentials,
AuthenticationDetails authenticationDetails) |
protected void |
publishBeforeLoginEvent(Credentials credentials) |
protected void |
publishDisconnectedEvent(UserSession previousSession) |
protected void |
publishLoginFailed(Credentials credentials,
LoginProvider provider,
LoginException e) |
protected void |
publishUserConnectedEvent(Credentials credentials) |
protected void |
publishUserSessionFinishedEvent(UserSession session) |
protected void |
publishUserSessionStartedEvent(Credentials credentials,
AuthenticationDetails authenticationDetails) |
protected void |
publishUserSessionSubstitutedEvent(UserSession previousSession,
UserSession session) |
void |
removeStateChangeListener(java.util.function.Consumer<Connection.StateChangeEvent> listener)
Remove a connection listener.
|
void |
removeUserSubstitutionListener(java.util.function.Consumer<Connection.UserSubstitutedEvent> listener)
Remove a user substitution listener.
|
protected void |
setSessionInternal(ClientUserSession userSession) |
void |
substituteUser(User substitutedUser)
Substitute a user in the current session with another user.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetSessionNN, login, loginAnonymous, loginByRememberMe@Inject protected AuthenticationService authenticationService
@Inject protected UserSessionService userSessionService
@Inject protected java.util.List<LoginProvider> loginProviders
@Inject protected Events events
@Inject protected Messages messages
@Inject protected BackgroundWorker backgroundWorker
@Inject protected GlobalConfig globalConfig
protected java.lang.String userRemoteAddress
protected EventHub eventHub
public void login(Credentials credentials) throws LoginException
Connectionlogin in interface Connectioncredentials - credentialsLoginException - if authentication failsprotected ClientUserSession createSession(UserSession userSession)
protected void preprocessCredentials(Credentials credentials)
@Nullable protected java.lang.String getUserRemoteAddress()
protected java.lang.String makeClientInfo()
protected java.util.TimeZone detectTimeZone()
protected com.vaadin.server.WebBrowser getWebBrowserDetails()
protected AuthenticationDetails loginInternal(Credentials credentials) throws LoginException
LoginExceptionprotected void fireStateChangeListeners(UserSession previousSession, UserSession newSession)
protected void fireSubstitutionListeners()
protected void publishUserConnectedEvent(Credentials credentials)
protected void publishBeforeLoginEvent(Credentials credentials) throws LoginException
LoginExceptionprotected void publishAfterLoginEvent(Credentials credentials, AuthenticationDetails authenticationDetails)
protected void publishLoginFailed(Credentials credentials, LoginProvider provider, LoginException e) throws LoginException
LoginExceptionprotected void publishUserSessionStartedEvent(Credentials credentials, AuthenticationDetails authenticationDetails)
protected ClientUserSession getSessionInternal()
protected void setSessionInternal(ClientUserSession userSession)
public void logout()
Connectionlogout in interface Connectionprotected void publishUserSessionFinishedEvent(UserSession session)
protected void publishUserSessionSubstitutedEvent(UserSession previousSession, UserSession session)
protected void publishDisconnectedEvent(UserSession previousSession)
@Nullable public UserSession getSession()
ConnectiongetSession in interface Connectionpublic void substituteUser(User substitutedUser)
ConnectionNew user is usually obtained from the current user's substitution list:
see User.getSubstitutions()
substituteUser in interface ConnectionsubstitutedUser - new userpublic boolean isConnected()
ConnectionisConnected in interface Connectionpublic boolean isAuthenticated()
ConnectionisAuthenticated in interface Connectionprotected java.util.List<LoginProvider> getProviders()
public boolean isAlive()
ConnectionisAlive in interface Connectionpublic void addStateChangeListener(java.util.function.Consumer<Connection.StateChangeEvent> listener)
ConnectionaddStateChangeListener in interface Connectionlistener - listener to addpublic void removeStateChangeListener(java.util.function.Consumer<Connection.StateChangeEvent> listener)
ConnectionremoveStateChangeListener in interface Connectionlistener - listener to removepublic void addUserSubstitutionListener(java.util.function.Consumer<Connection.UserSubstitutedEvent> listener)
ConnectionaddUserSubstitutionListener in interface Connectionlistener - listener to addpublic void removeUserSubstitutionListener(java.util.function.Consumer<Connection.UserSubstitutedEvent> listener)
ConnectionremoveUserSubstitutionListener in interface Connectionlistener - listener to remove@PostConstruct protected void init()