Class AbstractSecurityProviderRegistrar
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.common.util.security.AbstractSecurityProviderRegistrar
-
- All Implemented Interfaces:
NamedResource
,OptionalFeature
,PropertyResolver
,SecurityProviderChoice
,SecurityProviderRegistrar
- Direct Known Subclasses:
BouncyCastleSecurityProviderRegistrar
,EdDSASecurityProviderRegistrar
,SunJCESecurityProviderRegistrar
public abstract class AbstractSecurityProviderRegistrar extends AbstractLoggingBean implements SecurityProviderRegistrar
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
name
protected java.util.Map<java.lang.String,java.lang.Object>
props
protected java.util.concurrent.atomic.AtomicReference<java.security.Provider>
providerHolder
protected java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.String,java.lang.Boolean>>
supportedEntities
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.common.NamedResource
BY_NAME_COMPARATOR, NAME_EXTRACTOR
-
Fields inherited from interface org.apache.sshd.common.OptionalFeature
FALSE, TRUE
-
Fields inherited from interface org.apache.sshd.common.PropertyResolver
EMPTY
-
Fields inherited from interface org.apache.sshd.common.util.security.SecurityProviderChoice
EMPTY
-
Fields inherited from interface org.apache.sshd.common.util.security.SecurityProviderRegistrar
ALL_OPTIONS_VALUE, ALL_OPTIONS_WILDCARD, CONFIG_PROP_BASE, ENABLED_PROPERTY, NAMED_PROVIDER_PROPERTY, NO_OPTIONS_VALUE, SECURITY_ENTITIES
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSecurityProviderRegistrar(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.security.Provider
createProviderInstance(java.lang.String providerClassName)
java.lang.String
getName()
protected java.security.Provider
getOrCreateProvider(java.lang.String providerClassName)
Attempts to see if a provider with this name already registered.java.util.Map<java.lang.String,java.lang.Object>
getProperties()
A map of properties that can be used to configure the SSH server or client.boolean
isSecurityEntitySupported(java.lang.Class<?> entityType, java.lang.String name)
java.lang.String
toString()
-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.OptionalFeature
isSupported
-
Methods inherited from interface org.apache.sshd.common.PropertyResolver
getBoolean, getBooleanProperty, getCharset, getInteger, getIntProperty, getLong, getLongProperty, getObject, getString, getStringProperty, isEmpty
-
Methods inherited from interface org.apache.sshd.common.util.security.SecurityProviderChoice
getProviderName, getSecurityProvider
-
Methods inherited from interface org.apache.sshd.common.util.security.SecurityProviderRegistrar
getBasePropertyName, getConfigurationPropertyName, getDefaultSecurityEntitySupportValue, getParentPropertyResolver, isCertificateFactorySupported, isCipherSupported, isEnabled, isKeyAgreementSupported, isKeyFactorySupported, isKeyPairGeneratorSupported, isMacSupported, isMessageDigestSupported, isNamedProviderUsed, isSignatureSupported
-
-
-
-
Field Detail
-
props
protected final java.util.Map<java.lang.String,java.lang.Object> props
-
supportedEntities
protected final java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.String,java.lang.Boolean>> supportedEntities
-
providerHolder
protected final java.util.concurrent.atomic.AtomicReference<java.security.Provider> providerHolder
-
name
private final java.lang.String name
-
-
Method Detail
-
getName
public final java.lang.String getName()
- Specified by:
getName
in interfaceNamedResource
- Returns:
- The resource name
-
getProperties
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
Description copied from interface:PropertyResolver
A map of properties that can be used to configure the SSH server or client. This map will never be changed by either the server or client and is not supposed to be changed at runtime (changes are not bound to have any effect on a running client or server), though it may affect the creation of sessions later as these values are usually not cached.
Note: the type of the mapped property should match the expected configuration value type -
Long, Integer, Boolean, String
, etc.... If it doesn't, thetoString()
result of the mapped value is used to convert it to the required type. E.g., if the mapped value is the string "1234" and the expected value is along
then it will be parsed into one. Also, if the mapped value is anInteger
but along
is expected, then it will be converted into one.- Specified by:
getProperties
in interfacePropertyResolver
- Specified by:
getProperties
in interfaceSecurityProviderRegistrar
- Returns:
- a valid
Map
containing configuration values, nevernull
. Note: may be immutable.
-
isSecurityEntitySupported
public boolean isSecurityEntitySupported(java.lang.Class<?> entityType, java.lang.String name)
- Specified by:
isSecurityEntitySupported
in interfaceSecurityProviderRegistrar
-
getOrCreateProvider
protected java.security.Provider getOrCreateProvider(java.lang.String providerClassName) throws java.lang.ReflectiveOperationException
Attempts to see if a provider with this name already registered. If not, then uses reflection API in order to load and instantiate the specified providerClassName- Parameters:
providerClassName
- The fully-qualified class name to instantiate if a provider not already registered- Returns:
- The resolved
Provider
instance - Note: the result is cached - i.e., successful resolution result will not cause the code to re-resolve the provider - Throws:
java.lang.ReflectiveOperationException
- If failed to instantiate the providerjava.lang.UnsupportedOperationException
- If registrar not supported- See Also:
OptionalFeature.isSupported()
,Security.getProvider(String)
,createProviderInstance(String)
-
createProviderInstance
protected java.security.Provider createProviderInstance(java.lang.String providerClassName) throws java.lang.ReflectiveOperationException
- Throws:
java.lang.ReflectiveOperationException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-