public class UserPasswordAuthInit extends java.lang.Object implements AuthInitialize
AuthInitialize
implementation that obtains the user name and password as the
credentials from the given set of properties.
To use this class the security-client-auth-init
property should be set to the fully
qualified name the static create
method viz.
org.apache.geode.security.templates.UserPasswordAuthInit.create
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PASSWORD |
protected LogWriter |
securityLogWriter |
protected LogWriter |
systemLogWriter |
static java.lang.String |
USER_NAME |
SECURITY_PASSWORD, SECURITY_USERNAME
Constructor and Description |
---|
UserPasswordAuthInit() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Called when the region containing this callback is closed or destroyed, when the cache is
closed, or when a callback is removed from a region using an
AttributesMutator . |
static AuthInitialize |
create() |
java.util.Properties |
getCredentials(java.util.Properties securityProperties,
DistributedMember server,
boolean isPeer)
Initialize with the given set of security properties and return the credentials for the
peer/client as properties.
|
void |
init(LogWriter systemLogWriter,
LogWriter securityLogWriter)
Initialize the callback for a client/peer.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCredentials, init
init, initialize
public static final java.lang.String USER_NAME
public static final java.lang.String PASSWORD
protected LogWriter systemLogWriter
protected LogWriter securityLogWriter
public static AuthInitialize create()
public void init(LogWriter systemLogWriter, LogWriter securityLogWriter) throws AuthenticationFailedException
AuthInitialize
init
in interface AuthInitialize
systemLogWriter
- LogWriter
for system logssecurityLogWriter
- LogWriter
for security logsAuthenticationFailedException
- if some exception occurs during the initializationpublic java.util.Properties getCredentials(java.util.Properties securityProperties, DistributedMember server, boolean isPeer) throws AuthenticationFailedException
AuthInitialize
getCredentials
in interface AuthInitialize
securityProperties
- the security properties obtained using a call to
DistributedSystem.getSecurityProperties()
that will be used for obtaining the
credentialsserver
- the DistributedMember
object of the server/group-coordinator to which
connection is being attemptedisPeer
- true when this is invoked for peer initialization and false when invoked for
client initializationserver
It needs to contain "security-username" and "security-password"
When using Integrated security, all members, peer/client will use the same credentials.
but we still need to use these params to support the old authenticatorAuthenticationFailedException
- in case of failure to obtain the credentialspublic void close()
CacheCallback
AttributesMutator
.
Implementations should cleanup any external resources such as database connections. Any runtime exceptions this method throws will be logged.
It is possible for this method to be called multiple times on a single callback instance, so implementations must be tolerant of this.
close
in interface CacheCallback
RegionService.close()
,
Region.close()
,
Region.localDestroyRegion()
,
Region.destroyRegion()
,
AttributesMutator