Class OpenSamlCredential
java.lang.Object
org.opensaml.security.credential.AbstractCredential
org.opensaml.security.credential.BasicCredential
org.opensaml.security.x509.BasicX509Credential
se.swedenconnect.security.credential.opensaml.OpenSamlCredential
- All Implemented Interfaces:
Credential
,MutableCredential
,X509Credential
A credential that implements OpenSAML's
X509Credential
interface and wraps a
PkiCredential
. This enables us to make use of features such as testing and re-loading (see
ReloadablePkiCredential
), but most importantly, it gives use a smooth way of instantiating OpenSAML
credentials.- Author:
- Martin Lindström (martin@idsec.se)
-
Constructor Summary
ConstructorDescriptionOpenSamlCredential
(X509Certificate entityCertificate, PrivateKey privateKey) Constructor setting up the credential by explicitly assigning the certificate and private key.OpenSamlCredential
(PkiCredential credential) Constructor setting up the OpenSAML credential by assigning aPkiCredential
instance. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Predicate that tells whether this credential resides in a hardware module.void
setEntityCertificate
(X509Certificate entityCertificate) void
setEntityCertificateChain
(Collection<X509Certificate> certificateChain) void
setPrivateKey
(PrivateKey privateKey) Methods inherited from class org.opensaml.security.x509.BasicX509Credential
getCredentialType, getCRLs, getSecretKey, setCRLs, setPublicKey, setSecretKey
Methods inherited from class org.opensaml.security.credential.BasicCredential
setEntityId, setUsageType
Methods inherited from class org.opensaml.security.credential.AbstractCredential
getCredentialContextSet, getEntityId, getKeyNames, getUsageType
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.opensaml.security.credential.Credential
getCredentialContextSet, getEntityId, getKeyNames, getUsageType
-
Constructor Details
-
OpenSamlCredential
public OpenSamlCredential(@Nonnull X509Certificate entityCertificate, @Nonnull PrivateKey privateKey) Constructor setting up the credential by explicitly assigning the certificate and private key.- Parameters:
entityCertificate
- the certificateprivateKey
- the private key
-
OpenSamlCredential
Constructor setting up the OpenSAML credential by assigning aPkiCredential
instance. This type of setting up theOpenSamlCredential
is recommended since it gives the benefits of monitoring (and reloading) credentials as well as a simple way to use hardware based keys (e.g.Pkcs11Credential
).- Parameters:
credential
- the credential to wrap in a OpenSAML credential
-
-
Method Details
-
getPublicKey
- Specified by:
getPublicKey
in interfaceCredential
- Overrides:
getPublicKey
in classBasicX509Credential
-
getPrivateKey
- Specified by:
getPrivateKey
in interfaceCredential
- Overrides:
getPrivateKey
in classAbstractCredential
-
setPrivateKey
- Specified by:
setPrivateKey
in interfaceMutableCredential
- Overrides:
setPrivateKey
in classBasicCredential
-
getEntityCertificate
- Specified by:
getEntityCertificate
in interfaceX509Credential
- Overrides:
getEntityCertificate
in classBasicX509Credential
-
setEntityCertificate
- Overrides:
setEntityCertificate
in classBasicX509Credential
-
getEntityCertificateChain
- Specified by:
getEntityCertificateChain
in interfaceX509Credential
- Overrides:
getEntityCertificateChain
in classBasicX509Credential
-
setEntityCertificateChain
- Overrides:
setEntityCertificateChain
in classBasicX509Credential
-
isHardwareCredential
public boolean isHardwareCredential()Predicate that tells whether this credential resides in a hardware module.- Returns:
true
if the credential resides in a hardware module andfalse
otherwise
-