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
ConstructorsConstructorDescriptionOpenSamlCredential(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 aPkiCredentialinstance. -
Method Summary
Modifier and TypeMethodDescriptionbooleanPredicate that tells whether this credential resides in a hardware module.voidsetEntityCertificate(X509Certificate entityCertificate) voidsetEntityCertificateChain(Collection<X509Certificate> certificateChain) voidsetPrivateKey(PrivateKey privateKey) Methods inherited from class org.opensaml.security.x509.BasicX509Credential
getCredentialType, getCRLs, getSecretKey, setCRLs, setPublicKey, setSecretKeyMethods inherited from class org.opensaml.security.credential.BasicCredential
setEntityId, setUsageTypeMethods inherited from class org.opensaml.security.credential.AbstractCredential
getCredentialContextSet, getEntityId, getKeyNames, getUsageTypeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 aPkiCredentialinstance. This type of setting up theOpenSamlCredentialis 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:
getPublicKeyin interfaceCredential- Overrides:
getPublicKeyin classBasicX509Credential
-
getPrivateKey
- Specified by:
getPrivateKeyin interfaceCredential- Overrides:
getPrivateKeyin classAbstractCredential
-
setPrivateKey
- Specified by:
setPrivateKeyin interfaceMutableCredential- Overrides:
setPrivateKeyin classBasicCredential
-
getEntityCertificate
- Specified by:
getEntityCertificatein interfaceX509Credential- Overrides:
getEntityCertificatein classBasicX509Credential
-
setEntityCertificate
- Overrides:
setEntityCertificatein classBasicX509Credential
-
getEntityCertificateChain
- Specified by:
getEntityCertificateChainin interfaceX509Credential- Overrides:
getEntityCertificateChainin classBasicX509Credential
-
setEntityCertificateChain
- Overrides:
setEntityCertificateChainin classBasicX509Credential
-
isHardwareCredential
public boolean isHardwareCredential()Predicate that tells whether this credential resides in a hardware module.- Returns:
trueif the credential resides in a hardware module andfalseotherwise
-