Class AbstractLoadCredentialsStrategy
- java.lang.Object
-
- org.italiangrid.voms.credential.impl.AbstractLoadCredentialsStrategy
-
- All Implemented Interfaces:
LoadCredentialsStrategy
,VOMSEnvironmentVariables
- Direct Known Subclasses:
DefaultLoadCredentialsStrategy
public abstract class AbstractLoadCredentialsStrategy extends java.lang.Object implements LoadCredentialsStrategy, VOMSEnvironmentVariables
Base class for load credentials strategy providing utility classes for loading credentials from the filesystem and notifying the results of load operations to interested listeners (viaLoadCredentialsEventListener
).
-
-
Field Summary
Fields Modifier and Type Field Description (package private) LoadCredentialsEventListener
listener
TheLoadCredentialsEventListener
that is notified of load credentials outcome.-
Fields inherited from interface org.italiangrid.voms.credential.VOMSEnvironmentVariables
PKCS12_USER_CERT, VOMS_USER_ID, X509_CERT_DIR, X509_USER_CERT, X509_USER_KEY, X509_USER_PROXY, X509_VOMS_DIR
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractLoadCredentialsStrategy(LoadCredentialsEventListener listener)
Constructor that let client pass in aLoadCredentialsEventListener
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
fileExistsAndIsReadable(java.lang.String filename)
Convenience method to check if a file exists and is readableprotected eu.emi.security.authn.x509.X509Credential
loadPEMCredential(java.lang.String privateKeyPath, java.lang.String certificatePath, eu.emi.security.authn.x509.helpers.PasswordSupplier pf)
Loads a PEM X.509 credential and notifies the registeredLoadCredentialsEventListener
of the load operation outcome.protected eu.emi.security.authn.x509.X509Credential
loadPKCS12Credential(java.lang.String pkcs12FilePath, eu.emi.security.authn.x509.helpers.PasswordSupplier pf)
Loads a PCKS12 X.509 credential and notifies the registeredLoadCredentialsEventListener
of the load operation outcome.protected eu.emi.security.authn.x509.X509Credential
loadProxyCredential(java.lang.String proxyPath)
Loads an X.509 proxy credential and notifies the registeredLoadCredentialsEventListener
of the load operation outcome.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.italiangrid.voms.credential.LoadCredentialsStrategy
loadCredentials
-
-
-
-
Field Detail
-
listener
LoadCredentialsEventListener listener
TheLoadCredentialsEventListener
that is notified of load credentials outcome.
-
-
Constructor Detail
-
AbstractLoadCredentialsStrategy
protected AbstractLoadCredentialsStrategy(LoadCredentialsEventListener listener)
Constructor that let client pass in aLoadCredentialsEventListener
.- Parameters:
listener
- the listener that is notified of load credential events from thisAbstractLoadCredentialsStrategy
.
-
-
Method Detail
-
fileExistsAndIsReadable
protected boolean fileExistsAndIsReadable(java.lang.String filename)
Convenience method to check if a file exists and is readable- Parameters:
filename
- the file to be checked- Returns:
true
if the file exists and is readable,false
otherwise
-
loadPEMCredential
protected eu.emi.security.authn.x509.X509Credential loadPEMCredential(java.lang.String privateKeyPath, java.lang.String certificatePath, eu.emi.security.authn.x509.helpers.PasswordSupplier pf)
Loads a PEM X.509 credential and notifies the registeredLoadCredentialsEventListener
of the load operation outcome.- Parameters:
privateKeyPath
- the path to the private keycertificatePath
- the path to the certificatepf
- aPasswordSupplier
used to resolve the private key password when needed- Returns:
- the loaded
X509Credential
, ornull
if the credential couldn't be loaded
-
loadPKCS12Credential
protected eu.emi.security.authn.x509.X509Credential loadPKCS12Credential(java.lang.String pkcs12FilePath, eu.emi.security.authn.x509.helpers.PasswordSupplier pf)
Loads a PCKS12 X.509 credential and notifies the registeredLoadCredentialsEventListener
of the load operation outcome.- Parameters:
pkcs12FilePath
- the path to the pkcs12 credentialpf
- aPasswordSupplier
used to resolve the private key password- Returns:
- the loaded
X509Credential
, ornull
if the credential couldn't be loaded
-
loadProxyCredential
protected eu.emi.security.authn.x509.X509Credential loadProxyCredential(java.lang.String proxyPath)
Loads an X.509 proxy credential and notifies the registeredLoadCredentialsEventListener
of the load operation outcome.- Parameters:
proxyPath
- the path to the proxy credential- Returns:
- the loaded
X509Credential
, ornull
if the credential couldn't be loaded
-
-