本文整理匯總了Java中org.springframework.security.authentication.AuthenticationProvider.supports方法的典型用法代碼示例。如果您正苦於以下問題:Java AuthenticationProvider.supports方法的具體用法?Java AuthenticationProvider.supports怎麽用?Java AuthenticationProvider.supports使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.security.authentication.AuthenticationProvider
的用法示例。
在下文中一共展示了AuthenticationProvider.supports方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: authenticate
import org.springframework.security.authentication.AuthenticationProvider; //導入方法依賴的package包/類
/**
* Authenticate against the given external providers.
*
* @see edu.ur.ir.security.ExternalAuthenticationProvider#authenticate(org.springframework.security.Authentication)
*/
public Authentication authenticate(Authentication authentication)
throws AuthenticationException {
AuthenticationException ae = null;
for( AuthenticationProvider provider : authenticationProviders)
{
try
{
// return out of loop as soon as authentication occurs
if( provider.supports(authentication.getClass()))
{
Authentication auth = provider.authenticate(authentication);
return auth;
}
}
catch(AuthenticationException exception)
{
ae = exception;
}
}
if( ae != null )
{
throw ae;
}
else
{
throw new BadCredentialsException(messages.getMessage("ProviderManager.providerNotFound",
authentication.getClass().getName()));
}
}
示例2: authenticate
import org.springframework.security.authentication.AuthenticationProvider; //導入方法依賴的package包/類
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
Authentication result = null;
for(AuthenticationProvider delegate : delegates){
if(delegate.supports(authentication.getClass()) && (result = delegate.authenticate(authentication)) != null){
break;
}
}
return result;
}
示例3: supports
import org.springframework.security.authentication.AuthenticationProvider; //導入方法依賴的package包/類
@Override
public boolean supports(Class<?> authentication) {
for(AuthenticationProvider delegate : delegates){
if(delegate.supports(authentication)){
return true;
}
}
return false;
}