Package org.opensaml.security.messaging
Class ServletRequestX509CredentialAdapter
- java.lang.Object
-
- org.opensaml.security.credential.AbstractCredential
-
- org.opensaml.security.messaging.ServletRequestX509CredentialAdapter
-
- All Implemented Interfaces:
Credential,X509Credential
public class ServletRequestX509CredentialAdapter extends AbstractCredential implements X509Credential
An adapter that exposes the X.509 certificates contained in the servlet request attribute.
-
-
Field Summary
Fields Modifier and Type Field Description private X509CertificatecertThe entity certificate.private List<X509Certificate>certChainThe certificate chain.static StringJAKARTA_X509_CERT_REQUEST_ATTRIBUTEServlet request attribute to pull certificate info from.static StringX509_CERT_REQUEST_ATTRIBUTEServlet request attribute to pull certificate info from.
-
Constructor Summary
Constructors Constructor Description ServletRequestX509CredentialAdapter(javax.servlet.ServletRequest request)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<? extends Credential>getCredentialType()Get the primary type of the credential instance.Collection<X509CRL>getCRLs()Gets a collection of CRLs associated with the credential.X509CertificategetEntityCertificate()Gets the public key certificate for the entity.Collection<X509Certificate>getEntityCertificateChain()Gets an immutable collection of certificates in the entity's trust chain.PublicKeygetPublicKey()Gets the public key for the entity.-
Methods inherited from class org.opensaml.security.credential.AbstractCredential
getCredentialContextSet, getEntityId, getKeyNames, getPrivateKey, getSecretKey, getUsageType, setEntityId, setPrivateKey, setPublicKey, setSecretKey, setUsageType
-
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, getPrivateKey, getSecretKey, getUsageType
-
-
-
-
Field Detail
-
X509_CERT_REQUEST_ATTRIBUTE
public static final String X509_CERT_REQUEST_ATTRIBUTE
Servlet request attribute to pull certificate info from.- See Also:
- Constant Field Values
-
JAKARTA_X509_CERT_REQUEST_ATTRIBUTE
public static final String JAKARTA_X509_CERT_REQUEST_ATTRIBUTE
Servlet request attribute to pull certificate info from.- See Also:
- Constant Field Values
-
cert
private X509Certificate cert
The entity certificate.
-
certChain
private List<X509Certificate> certChain
The certificate chain.
-
-
Constructor Detail
-
ServletRequestX509CredentialAdapter
public ServletRequestX509CredentialAdapter(javax.servlet.ServletRequest request) throws SecurityExceptionConstructor.- Parameters:
request- the servlet request- Throws:
SecurityException- if request does not contain an X.509 client certificate in request attribute 'javax.servlet.request.X509Certificate'
-
-
Method Detail
-
getCredentialType
public Class<? extends Credential> getCredentialType()
Get the primary type of the credential instance. This will usually be the primary sub-interface ofCredentialimplemented by an implementation.- Specified by:
getCredentialTypein interfaceCredential- Returns:
- the credential type
-
getEntityCertificate
public X509Certificate getEntityCertificate()
Gets the public key certificate for the entity. The public key of this certificate will be the same key obtained fromCredential.getPublicKey().- Specified by:
getEntityCertificatein interfaceX509Credential- Returns:
- the public key certificate for the entity
-
getEntityCertificateChain
public Collection<X509Certificate> getEntityCertificateChain()
Gets an immutable collection of certificates in the entity's trust chain. The entity certificate is contained within this list. No specific ordering of the certificates is guaranteed.- Specified by:
getEntityCertificateChainin interfaceX509Credential- Returns:
- entities certificate chain
-
getCRLs
public Collection<X509CRL> getCRLs()
Gets a collection of CRLs associated with the credential.- Specified by:
getCRLsin interfaceX509Credential- Returns:
- CRLs associated with the credential
-
getPublicKey
public PublicKey getPublicKey()
Gets the public key for the entity.- Specified by:
getPublicKeyin interfaceCredential- Overrides:
getPublicKeyin classAbstractCredential- Returns:
- public key for the entity
-
-