Package org.simpleframework.http.core
Class RequestCertificate
- java.lang.Object
-
- org.simpleframework.http.core.RequestCertificate
-
- All Implemented Interfaces:
Certificate
class RequestCertificate extends java.lang.Object implements Certificate
TheRequestCertificate
represents a certificate for an HTTP request. It basically wraps the raw SSL certificate that comes with theChannel
. Wrapping the raw certificate allows us to enforce the HTTPS workflow for SSL renegotiation, which requires some rather weird behaviour. Most importantly we only allow a challenge when the response has not been sent.- See Also:
CertificateChallenge
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
RequestCertificate.Challenge
TheChallenge
provides a basic wrapper around the challenge provided by the SSL connection.
-
Field Summary
Fields Modifier and Type Field Description private Certificate
certificate
This is the raw underlying certificate for the SSL channel.private CertificateChallenge
challenge
This is used to challenge the client for an X509 certificate.private Channel
channel
This is the channel representing the client connection.
-
Constructor Summary
Constructors Constructor Description RequestCertificate(BodyObserver observer, Entity entity)
Constructor for theRequestCertificate
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.security.cert.X509Certificate[]
getChain()
This will return the X509 certificate chain, if any, that has been sent by the client.CertificateChallenge
getChallenge()
This returns a challenge for the certificate.boolean
isChainPresent()
This is used to determine if the X509 certificate chain is present for the request.
-
-
-
Field Detail
-
challenge
private final CertificateChallenge challenge
This is used to challenge the client for an X509 certificate.
-
certificate
private final Certificate certificate
This is the raw underlying certificate for the SSL channel.
-
channel
private final Channel channel
This is the channel representing the client connection.
-
-
Constructor Detail
-
RequestCertificate
public RequestCertificate(BodyObserver observer, Entity entity)
Constructor for theRequestCertificate
. This is used to create a wrapper for the raw SSL certificate that is provided by the underlying SSL session.- Parameters:
observer
- the observer used to observe the transactionentity
- the request entity containing the data
-
-
Method Detail
-
getChain
public javax.security.cert.X509Certificate[] getChain() throws java.lang.Exception
This will return the X509 certificate chain, if any, that has been sent by the client. A certificate chain is typically only send when the server explicitly requests the certificate on the initial connection or when it is challenged for.- Specified by:
getChain
in interfaceCertificate
- Returns:
- this returns the clients X509 certificate chain
- Throws:
java.lang.Exception
-
getChallenge
public CertificateChallenge getChallenge() throws java.lang.Exception
This returns a challenge for the certificate. A challenge is issued by providing aRunnable
task which is to be executed when the challenge has completed. Typically this task should be used to drive completion of an HTTPS request.- Specified by:
getChallenge
in interfaceCertificate
- Returns:
- this returns a challenge for the client certificate
- Throws:
java.lang.Exception
-
isChainPresent
public boolean isChainPresent() throws java.lang.Exception
This is used to determine if the X509 certificate chain is present for the request. If it is not present then a challenge can be used to request the certificate.- Specified by:
isChainPresent
in interfaceCertificate
- Returns:
- true if the certificate chain is present
- Throws:
java.lang.Exception
-
-