public interface SpringSecurity
A set of buider methods is provided to setup a bridge from the Holon platform authentication and authorization API and the Spring Security architecture.
| Modifier and Type | Method and Description |
|---|---|
static Authenticator<AccountCredentialsToken> |
accountCredentialsAuthenticator(org.springframework.security.authentication.AuthenticationManager authenticationManager)
Create an
Authenticator for the default AccountCredentialsToken, using the Spring Security
AuthenticationManager to perform the authentication operations. |
static Authentication |
asAuthentication(org.springframework.security.core.Authentication authentication)
Get the
Authentication representation of the given Spring Security Authentication. |
static SpringSecurityAuthenticationToken |
asAuthenticationToken(org.springframework.security.core.Authentication authentication)
Create a new
AuthenticationToken using given Spring Security Authentication as concrete
authentication token. |
static SpringSecurityAuthenticationToken |
asAuthenticationToken(String accountId,
String secret)
Create an account credentials authentican token, using the Spring Security
UsernamePasswordAuthenticationToken as concrete authentication token. |
static org.springframework.security.core.GrantedAuthority |
asAuthority(Permission permission)
Get the Spring Security
GrantedAuthority representation of the given Permission. |
static Permission |
asPermission(org.springframework.security.core.GrantedAuthority authority)
Get the
Permission representation of the given Spring Security GrantedAuthority. |
static AuthContext |
authContext()
Create an
AuthContext which uses the Spring Security SecurityContext as authentication holder. |
static AuthContext |
authContext(org.springframework.security.authentication.AuthenticationManager authenticationManager)
Create an
AuthContext which uses the Spring Security SecurityContext as authentication holder. |
static AuthContext |
authContext(org.springframework.security.authentication.AuthenticationManager authenticationManager,
boolean accountCredentialsAuthenticator)
Create an
AuthContext which uses the Spring Security SecurityContext as authentication holder. |
static AuthContext |
authContext(Realm realm)
Create an
AuthContext which uses the Spring Security SecurityContext as authentication holder. |
static <T extends AuthenticationToken,A extends org.springframework.security.core.Authentication> |
authenticationProvider(Authenticator<T> authenticator,
Class<A> authenticationType,
Function<A,T> converter)
Create a Spring Security
AuthenticationProvider using an Authenticator as concrete authentication
provider. |
static Authenticator<SpringSecurityAuthenticationToken> |
authenticator(org.springframework.security.authentication.AuthenticationManager authenticationManager)
Create an
Authenticator which supports SpringSecurityAuthenticationToken types and uses the
Spring Security AuthenticationManager to perform the authentication operations. |
static AuthContext authContext()
AuthContext which uses the Spring Security SecurityContext as authentication holder.
The default SecurityContextHolder.getContext() method is used to obtain the Spring Security
SecurityContext reference.
The AuthContext is bound to a default Realm instance, configured with the default
Authorizer.
AuthContext using the Spring Security SecurityContext as authentication holderauthContext(Realm)static AuthContext authContext(Realm realm)
AuthContext which uses the Spring Security SecurityContext as authentication holder.
The default SecurityContextHolder.getContext() method is used to obtain the Spring Security
SecurityContext reference.realm - The Realm to which the auth context is bound (not null)AuthContext bound to given realm and using the Spring Security SecurityContext as
authentication holderstatic AuthContext authContext(org.springframework.security.authentication.AuthenticationManager authenticationManager)
AuthContext which uses the Spring Security SecurityContext as authentication holder.
The default SecurityContextHolder.getContext() method is used to obtain the Spring Security
SecurityContext reference.
A default Realm is created using the default authorizer and registering an Authenticator hich
supports SpringSecurityAuthenticationToken types and uses the Spring Security
AuthenticationManager to perform the authentication operations.
authenticationManager - The Spring Security AuthenticationManager (not null)AuthContext instanceauthContext(Realm)static AuthContext authContext(org.springframework.security.authentication.AuthenticationManager authenticationManager, boolean accountCredentialsAuthenticator)
AuthContext which uses the Spring Security SecurityContext as authentication holder.
The default SecurityContextHolder.getContext() method is used to obtain the Spring Security
SecurityContext reference.
A default Realm is created using the default authorizer and registering an Authenticator hich
supports SpringSecurityAuthenticationToken types and uses the Spring Security
AuthenticationManager to perform the authentication operations.
authenticationManager - The Spring Security AuthenticationManager (not null)accountCredentialsAuthenticator - Whether to register in Realm an Authenticator for the default
AccountCredentialsToken which uses the Spring Security AuthenticationManager to perform
the authentication operations.AuthContext instanceauthContext(Realm)static Authenticator<SpringSecurityAuthenticationToken> authenticator(org.springframework.security.authentication.AuthenticationManager authenticationManager)
Authenticator which supports SpringSecurityAuthenticationToken types and uses the
Spring Security AuthenticationManager to perform the authentication operations. The
SpringSecurityAuthenticationToken.getAuthentication() reference is used as authentication token whithin
the Spring Security environment.authenticationManager - The Spring Security AuthenticationManager (not null)Authenticator instancestatic Authenticator<AccountCredentialsToken> accountCredentialsAuthenticator(org.springframework.security.authentication.AuthenticationManager authenticationManager)
Authenticator for the default AccountCredentialsToken, using the Spring Security
AuthenticationManager to perform the authentication operations.authenticationManager - The Spring Security AuthenticationManager (not null)Authenticator instancestatic <T extends AuthenticationToken,A extends org.springframework.security.core.Authentication> org.springframework.security.authentication.AuthenticationProvider authenticationProvider(Authenticator<T> authenticator, Class<A> authenticationType, Function<A,T> converter)
AuthenticationProvider using an Authenticator as concrete authentication
provider. Authentication execeptions translation is applied by default.T - Authentication token typeA - Spring Security Authentication typeauthenticator - The concrete AuthenticatorauthenticationType - Supported Spring Security Authentication typeconverter - Function to convert the Spring Security Authentication into the required
AuthenticationToken typeAuthenticationProvider using given Authenticatorstatic Authentication asAuthentication(org.springframework.security.core.Authentication authentication)
Authentication representation of the given Spring Security Authentication.
If authentication details are available through
Authentication.getDetails(), it will be available as an
Authentication parameter with name SpringSecurityAuthentication.AUTHENTICATION_DETAILS_KEY.
authentication - The Spring Security Authentication (not null)Authentication representation of the Spring Security Authenticationstatic Permission asPermission(org.springframework.security.core.GrantedAuthority authority)
Permission representation of the given Spring Security GrantedAuthority.authority - The GrantedAuthority to be represented as a Permission (not null)Permission representation of the Spring Security GrantedAuthoritystatic org.springframework.security.core.GrantedAuthority asAuthority(Permission permission)
GrantedAuthority representation of the given Permission.permission - The Permission to be represented as a GrantedAuthority (not null)GrantedAuthority representation of given Permissionstatic SpringSecurityAuthenticationToken asAuthenticationToken(org.springframework.security.core.Authentication authentication)
AuthenticationToken using given Spring Security Authentication as concrete
authentication token.authentication - the Spring Security Authentication token (not null)SpringSecurityAuthenticationTokenstatic SpringSecurityAuthenticationToken asAuthenticationToken(String accountId, String secret)
UsernamePasswordAuthenticationToken as concrete authentication token.accountId - Account id (username)secret - Account secret (password)SpringSecurityAuthenticationToken with given account credentialsCopyright © 2019 The Holon Platform. All rights reserved.