Class RemoteAuthenticationProvider
- java.lang.Object
-
- org.springframework.security.authentication.rcp.RemoteAuthenticationProvider
-
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
,AuthenticationProvider
public class RemoteAuthenticationProvider extends java.lang.Object implements AuthenticationProvider, org.springframework.beans.factory.InitializingBean
Client-side object which queries aRemoteAuthenticationManager
to validate an authentication request.A new
Authentication
object is created by this class comprising the requestAuthentication
object'sprincipal
,credentials
and theGrantedAuthority
[]s returned by theRemoteAuthenticationManager
.The
RemoteAuthenticationManager
should not require any special username or password setting on the remoting client proxy factory to execute the call. Instead the entire authentication request must be encapsulated solely within theAuthentication
request object. In practical terms this means theRemoteAuthenticationManager
will not be protected by BASIC or any other HTTP-level authentication.If authentication fails, a
RemoteAuthenticationException
will be thrown. This exception should be caught and displayed to the user, enabling them to retry with alternative credentials etc.
-
-
Constructor Summary
Constructors Constructor Description RemoteAuthenticationProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
Authentication
authenticate(Authentication authentication)
Performs authentication with the same contract asAuthenticationManager.authenticate(Authentication)
.RemoteAuthenticationManager
getRemoteAuthenticationManager()
void
setRemoteAuthenticationManager(RemoteAuthenticationManager remoteAuthenticationManager)
boolean
supports(java.lang.Class<?> authentication)
Returnstrue
if thisAuthenticationProvider
supports the indicatedAuthentication
object.
-
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
authenticate
public Authentication authenticate(Authentication authentication) throws AuthenticationException
Description copied from interface:AuthenticationProvider
Performs authentication with the same contract asAuthenticationManager.authenticate(Authentication)
.- Specified by:
authenticate
in interfaceAuthenticationProvider
- Parameters:
authentication
- the authentication request object.- Returns:
- a fully authenticated object including credentials. May return
null
if theAuthenticationProvider
is unable to support authentication of the passedAuthentication
object. In such a case, the nextAuthenticationProvider
that supports the presentedAuthentication
class will be tried. - Throws:
AuthenticationException
- if authentication fails.
-
getRemoteAuthenticationManager
public RemoteAuthenticationManager getRemoteAuthenticationManager()
-
setRemoteAuthenticationManager
public void setRemoteAuthenticationManager(RemoteAuthenticationManager remoteAuthenticationManager)
-
supports
public boolean supports(java.lang.Class<?> authentication)
Description copied from interface:AuthenticationProvider
Returnstrue
if thisAuthenticationProvider
supports the indicatedAuthentication
object.Returning
true
does not guarantee anAuthenticationProvider
will be able to authenticate the presented instance of theAuthentication
class. It simply indicates it can support closer evaluation of it. AnAuthenticationProvider
can still returnnull
from theAuthenticationProvider.authenticate(Authentication)
method to indicate anotherAuthenticationProvider
should be tried.Selection of an
AuthenticationProvider
capable of performing authentication is conducted at runtime theProviderManager
.- Specified by:
supports
in interfaceAuthenticationProvider
- Returns:
true
if the implementation can more closely evaluate theAuthentication
class presented
-
-