Class CachingPublicKeyAuthenticator
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.server.auth.pubkey.CachingPublicKeyAuthenticator
-
- All Implemented Interfaces:
PublickeyAuthenticator
public class CachingPublicKeyAuthenticator extends AbstractLoggingBean implements PublickeyAuthenticator
Caches the result per session - compensates forOpenSSH
behavior where it sends 2 requests with the same key (seeSSHD-300
).- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description protected PublickeyAuthenticator
authenticator
static AttributeRepository.AttributeKey<Map<PublicKey,Boolean>>
CACHE_ATTRIBUTE
TheAttributeKey
used to store the cached authentication results on the session instance-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
-
Constructor Summary
Constructors Constructor Description CachingPublicKeyAuthenticator(PublickeyAuthenticator authenticator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
authenticate(String username, PublicKey key, ServerSession session)
Check the validity of a public key.protected Map<PublicKey,Boolean>
resolveCachedResults(String username, PublicKey key, ServerSession session)
-
-
-
Field Detail
-
CACHE_ATTRIBUTE
public static final AttributeRepository.AttributeKey<Map<PublicKey,Boolean>> CACHE_ATTRIBUTE
TheAttributeKey
used to store the cached authentication results on the session instance
-
authenticator
protected final PublickeyAuthenticator authenticator
-
-
Constructor Detail
-
CachingPublicKeyAuthenticator
public CachingPublicKeyAuthenticator(PublickeyAuthenticator authenticator)
-
-
Method Detail
-
authenticate
public boolean authenticate(String username, PublicKey key, ServerSession session)
Description copied from interface:PublickeyAuthenticator
Check the validity of a public key.- Specified by:
authenticate
in interfacePublickeyAuthenticator
- Parameters:
username
- the usernamekey
- the keysession
- the server session- Returns:
- a boolean indicating if authentication succeeded or not
-
-