public class GenericVaadinSecurity extends AbstractVaadinSecurity implements VaadinSecurity
HttpSessionSecurityContextRepository| Modifier and Type | Field and Description |
|---|---|
static String |
SPRING_SECURITY_CONTEXT_KEY
The default key under which the security context will be stored in the session.
|
| Constructor and Description |
|---|
GenericVaadinSecurity() |
| Modifier and Type | Method and Description |
|---|---|
Authentication |
getAuthentication()
Gets the authentication token of the current user.
|
boolean |
hasAccessToObject(Object securedObject,
String... securityConfigurationAttributes)
Checks if the current user is authorized based on the specified security configuration attributes.
|
boolean |
hasAccessToSecuredMethod(Object securedObject,
String methodName,
Class<?>... methodParameterTypes)
Uses the
Secured annotation on the specified method to check if the current user has access to the secured object. |
boolean |
hasAccessToSecuredObject(Object securedObject)
Convenience method that invokes
VaadinSecurity.hasAccessToObject(Object, String...), using the Secured annotation of the secured object
to get the security configuration attributes. |
boolean |
hasAnyAuthority(String... authorities)
Checks if the current user has at least one of the specified authorities.
|
boolean |
hasAuthorities(String... authorities)
Checks if the current user has all required authorities.
|
boolean |
hasAuthority(String authority)
Checks if the current user has the specified authority.
|
boolean |
isAuthenticated()
Checks if the current user is authenticated.
|
void |
login(Authentication authentication)
Tries to login using the specified authentication object.
|
void |
login(Authentication authentication,
boolean rememberMe)
Tries to login using the specified authentication object.
|
void |
login(String username,
String password)
Convenience method that invokes
VaadinSecurity.login(org.springframework.security.core.Authentication) with a
UsernamePasswordAuthenticationToken-object. |
void |
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, and have Spring-Security handle the logout with the configured
LogoutConfigurer of the HttpSecurity.
|
void |
setLogoutProcessingUrl(String logoutUrl)
Set the logout processing URL, defaults to '/logout'.
|
void |
setSpringSecurityContextKey(String springSecurityContextKey)
Allows the session attribute name to be customized for this repository instance.
|
addAuthenticationFailureHandler, addAuthenticationSuccessHandler, afterPropertiesSet, getAccessDecisionManager, getApplicationContext, getAuthenticationFailureHandler, getAuthenticationManager, getAuthenticationSuccessHandler, getSessionAuthenticationStrategy, hasAccessDecisionManager, hasAuthenticationFailureHandlerConfigured, hasAuthenticationSuccessHandlerConfigured, setApplicationContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddAuthenticationFailureHandler, addAuthenticationSuccessHandler, getAccessDecisionManager, getApplicationContext, getAuthenticationManager, getSessionAuthenticationStrategy, hasAccessDecisionManager, hasAuthenticationFailureHandlerConfigured, hasAuthenticationSuccessHandlerConfiguredpublic static final String SPRING_SECURITY_CONTEXT_KEY
HttpSessionSecurityContextRepository
springSecurityContextKey within HttpSessionSecurityContextRepository
to match the new key.
HttpSessionSecurityContextRepository can be overriden with HttpSessionSecurityContextRepository
SecurityContextPersistenceFilter will use the configured key from HttpSessionSecurityContextRepositorypublic boolean isAuthenticated()
isAuthenticated in interface VaadinSecuritySecurityContext contains an Authentication token,
and the token has been authenticated by an AuthenticationManager.Authentication.isAuthenticated()public void login(Authentication authentication, boolean rememberMe) throws AuthenticationException, Exception
login in interface VaadinSecurityauthentication - the authentication object to authenticate, must not be null.rememberMe - boolean to indicate if remember me authentication should be activatedAuthenticationException - if authentication fails.Exceptionpublic void login(Authentication authentication) throws AuthenticationException, Exception
Remember Me authentication is ignored
login in interface VaadinSecurityauthentication - the authentication object to authenticate, must not be null.AuthenticationException - if authentication fails.Exceptionpublic void login(String username, String password, boolean rememberMe) throws AuthenticationException, Exception
VaadinSecurity.login(org.springframework.security.core.Authentication) with a
UsernamePasswordAuthenticationToken-object.login in interface VaadinSecurityusername - the username to use, must not be null.password - the password to use, must not be null.rememberMe - boolean to set remember me authenticationAuthenticationException - if authentication fails.javax.servlet.ServletException - if Authentication{Success/Failure}Handler failsIOException - if Authentication{Success/Failure}Handler failsExceptionpublic void login(String username, String password) throws AuthenticationException, Exception
VaadinSecurity.login(org.springframework.security.core.Authentication) with a
UsernamePasswordAuthenticationToken-object.
Remember me authentication is ignored
login in interface VaadinSecurityusername - the username to use, must not be null.password - the password to use, must not be null.AuthenticationException - if authentication fails.javax.servlet.ServletException - if Authentication{Success/Failure}Handler failsIOException - if Authentication{Success/Failure}Handler failsExceptionpublic void setLogoutProcessingUrl(String logoutUrl)
setLogoutProcessingUrl in interface VaadinSecuritylogoutUrl - the use url at which the logout is configured with HttpSecuritypublic void logout()
logout in interface VaadinSecuritypublic boolean hasAuthority(String authority)
VaadinSecurity.hasAccessToObject(Object, String...).hasAuthority in interface VaadinSecurityauthority - the authority to check, must not be null.SecurityContext contains an authenticated Authentication
token that has a GrantedAuthority whose string representation matches the specified authority.Authentication.getAuthorities(),
GrantedAuthority.getAuthority()public Authentication getAuthentication()
getAuthentication in interface VaadinSecurityAuthentication token stored in the current SecurityContext, or null.public boolean hasAccessToObject(Object securedObject, String... securityConfigurationAttributes)
Secured annotation).hasAccessToObject in interface VaadinSecuritysecuredObject - the secured object.securityConfigurationAttributes - the security configuration attributes.public boolean hasAccessToSecuredObject(Object securedObject)
VaadinSecurity.hasAccessToObject(Object, String...), using the Secured annotation of the secured object
to get the security configuration attributes.hasAccessToSecuredObject in interface VaadinSecuritysecuredObject - the secured object, must not be null and must have the Secured annotation.public boolean hasAccessToSecuredMethod(Object securedObject, String methodName, Class<?>... methodParameterTypes)
Secured annotation on the specified method to check if the current user has access to the secured object.hasAccessToSecuredMethod in interface VaadinSecuritysecuredObject - the secured object, must not be null.methodName - the name of the method holding the Secured annotation.methodParameterTypes - the parameter types of the method holding the Secured annotation.VaadinSecurity.hasAccessToSecuredObject(Object)public boolean hasAuthorities(String... authorities)
hasAuthorities in interface VaadinSecurityauthorities - the required authorities.VaadinSecurity.hasAuthority(String),
VaadinSecurity.hasAnyAuthority(String...)public boolean hasAnyAuthority(String... authorities)
hasAnyAuthority in interface VaadinSecurityauthorities - the authorities.VaadinSecurity.hasAuthority(String),
VaadinSecurity.hasAuthorities(String...)public void setSpringSecurityContextKey(String springSecurityContextKey)
setSpringSecurityContextKey in interface VaadinSecurityspringSecurityContextKey - the key under which the security context will be stored. Defaults toCopyright © 2015. All rights reserved.