public class DefaultVaadinSharedSecurity extends AbstractVaadinSecurity implements VaadinSharedSecurity
VaadinSharedSecurity.| Modifier and Type | Class and Description |
|---|---|
protected class |
DefaultVaadinSharedSecurity.RememberMeRequestWrapper
A request wrapper that overrides the value of the remember me parameter based on the values provided in the
constructor.
|
| Constructor and Description |
|---|
DefaultVaadinSharedSecurity() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
Authentication |
getAuthentication()
Gets the authentication token of the current user.
|
protected javax.servlet.http.HttpServletRequest |
getCurrentRequest()
Returns the HTTP request bound to the current thread.
|
protected javax.servlet.http.HttpServletResponse |
getCurrentResponse()
Returns the HTTP response bound to the current thread.
|
protected String |
getRememberMeParameter()
Returns the name of the request parameter that enables or disables remember me authentication.
|
protected SessionAuthenticationStrategy |
getSessionAuthenticationStrategy() |
protected VaadinAuthenticationSuccessHandler |
getVaadinAuthenticationSuccessHandler() |
protected VaadinLogoutHandler |
getVaadinLogoutHandler() |
Authentication |
login(Authentication authentication)
Tries to login using the specified authentication object.
|
Authentication |
login(Authentication authentication,
boolean rememberMe)
Tries to login using the specified authentication object.
|
Authentication |
login(String username,
String password,
boolean rememberMe)
Convenience method that invokes
VaadinSecurity.login(org.springframework.security.core.Authentication) with a
UsernamePasswordAuthenticationToken-object. |
void |
logout()
Logs the user out.
|
void |
setSaveContextInSessionAfterLogin(boolean saveContextInSessionAfterLogin)
Specifies whether the security context should be explicitly saved in the session after
login(org.springframework.security.core.Authentication, boolean)
completes. |
void |
setSessionAuthenticationStrategy(SessionAuthenticationStrategy sessionAuthenticationStrategy)
Makes it possible to replace the
SessionAuthenticationStrategy after
the bean has been configured. |
void |
setSpringSecurityContextKey(String springSecurityContextKey)
Sets the session attribute key under which the security context is stored.
|
void |
setVaadinAuthenticationSuccessHandler(VaadinAuthenticationSuccessHandler vaadinAuthenticationSuccessHandler)
Makes it possible to replace the
VaadinAuthenticationSuccessHandler after
the bean has been configured. |
void |
setVaadinLogoutHandler(VaadinLogoutHandler vaadinLogoutHandler)
Makes it possible to replace the
VaadinLogoutHandler after
the bean has been configured. |
protected void |
successfulAuthentication(Authentication authentication,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Called by
login(Authentication, boolean) upon successful authentication. |
protected void |
unsuccessfulAuthentication(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Called by
login(Authentication, boolean) upon unsuccessful authentication. |
getAccessDecisionManager, getApplicationContext, getAuthenticationManager, getRememberMeServices, hasAccessDecisionManager, hasAccessToObject, hasAccessToSecuredMethod, hasAccessToSecuredObject, hasAnyAuthority, hasAuthenticationManager, hasAuthorities, hasAuthority, isAuthenticated, isAuthenticatedAnonymously, isFullyAuthenticated, isRememberMeAuthenticated, login, setApplicationContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithasAccessToObject, hasAccessToSecuredMethod, hasAccessToSecuredObject, hasAnyAuthority, hasAuthorities, hasAuthority, isAuthenticated, isAuthenticatedAnonymously, isFullyAuthenticated, isRememberMeAuthenticated, logingetAccessDecisionManager, getApplicationContext, getAuthenticationManager, getRememberMeServices, hasAccessDecisionManager, hasAuthenticationManagerpublic Authentication login(Authentication authentication, boolean rememberMe) throws Exception
VaadinSharedSecuritylogin in interface VaadinSharedSecurityauthentication - the authentication object to authenticate, must not be null.rememberMe - boolean to indicate if remember me authentication should be activatedAuthentication token.AuthenticationException - if authentication fails.Exceptionprotected String getRememberMeParameter()
RememberMeServices extends AbstractRememberMeServices,
the parameter will be retrieved from there. Otherwise, AbstractRememberMeServices.DEFAULT_PARAMETER is
returned.protected void unsuccessfulAuthentication(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
login(Authentication, boolean) upon unsuccessful authentication. This implementation will
clear the security context holder and inform the RememberMeServices of the failed login.request - the current request.response - the current response.protected void successfulAuthentication(Authentication authentication, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception
login(Authentication, boolean) upon successful authentication. This implementation will
update the security context holder, inform the RememberMeServices and invoke the authentication success
handler.authentication - the authentication token returned by the
AuthenticationManager.request - the current request.response - the current response.Exceptionprotected javax.servlet.http.HttpServletRequest getCurrentRequest()
protected javax.servlet.http.HttpServletResponse getCurrentResponse()
public Authentication login(String username, String password, boolean rememberMe) throws Exception
VaadinSharedSecurityVaadinSecurity.login(org.springframework.security.core.Authentication) with a
UsernamePasswordAuthenticationToken-object.login in interface VaadinSharedSecurityusername - the username to use, must not be null.password - the password to use, must not be null.rememberMe - boolean to set remember me authenticationAuthentication token.AuthenticationException - if authentication fails.Exceptionpublic Authentication login(Authentication authentication) throws Exception
VaadinSecuritylogin in interface VaadinSecurityauthentication - the authentication object to authenticate, must not be null.Authentication token.AuthenticationException - if authentication fails.Exceptionpublic void logout()
VaadinSecuritylogout in interface VaadinSecuritypublic Authentication getAuthentication()
VaadinSecuritygetAuthentication in interface VaadinSecurityAuthentication token stored in the current
SecurityContext, or null.public void setSpringSecurityContextKey(String springSecurityContextKey)
HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY.public void setSaveContextInSessionAfterLogin(boolean saveContextInSessionAfterLogin)
login(org.springframework.security.core.Authentication, boolean)
completes. Defaults to false.setSpringSecurityContextKey(String)public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface InitializingBeanafterPropertiesSet in class AbstractVaadinSecurityExceptionpublic void setVaadinAuthenticationSuccessHandler(VaadinAuthenticationSuccessHandler vaadinAuthenticationSuccessHandler)
VaadinAuthenticationSuccessHandler after
the bean has been configured.protected VaadinAuthenticationSuccessHandler getVaadinAuthenticationSuccessHandler()
public void setSessionAuthenticationStrategy(SessionAuthenticationStrategy sessionAuthenticationStrategy)
SessionAuthenticationStrategy after
the bean has been configured.protected SessionAuthenticationStrategy getSessionAuthenticationStrategy()
public void setVaadinLogoutHandler(VaadinLogoutHandler vaadinLogoutHandler)
VaadinLogoutHandler after
the bean has been configured.protected VaadinLogoutHandler getVaadinLogoutHandler()
Copyright © 2017. All rights reserved.