Class SelfSignedCertificateExtension
java.lang.Object
com.linecorp.armeria.testing.junit5.common.AbstractAllOrEachExtension
com.linecorp.armeria.testing.junit5.server.SelfSignedCertificateExtension
- All Implemented Interfaces:
AfterAllCallback
,AfterEachCallback
,BeforeAllCallback
,BeforeEachCallback
,Extension
public class SelfSignedCertificateExtension extends AbstractAllOrEachExtension
An
Extension
that provides a temporary self-signed certificate.-
Constructor Summary
Constructors Constructor Description SelfSignedCertificateExtension()
Creates a new instance.SelfSignedCertificateExtension(String fqdn)
Creates a new instance.SelfSignedCertificateExtension(String fqdn, SecureRandom random, int bits)
Creates a new instance.SelfSignedCertificateExtension(String fqdn, SecureRandom random, int bits, TemporalAccessor notBefore, TemporalAccessor notAfter)
Creates a new instance.SelfSignedCertificateExtension(String fqdn, TemporalAccessor notBefore, TemporalAccessor notAfter)
Creates a new instance.SelfSignedCertificateExtension(TemporalAccessor notBefore, TemporalAccessor notAfter)
Creates a new instance. -
Method Summary
Modifier and Type Method Description void
after(ExtensionContext context)
Deletes the generatedSelfSignedCertificate
.void
before(ExtensionContext context)
Generates aSelfSignedCertificate
.X509Certificate
certificate()
Returns the generatedX509Certificate
.File
certificateFile()
Returns the self-signed certificate file.PrivateKey
privateKey()
Returns thePrivateKey
of the self-signed certificate.File
privateKeyFile()
Returns the private key file of the self-signed certificate.Methods inherited from class com.linecorp.armeria.testing.junit5.common.AbstractAllOrEachExtension
afterAll, afterEach, beforeAll, beforeEach, runForEachTest
-
Constructor Details
-
SelfSignedCertificateExtension
public SelfSignedCertificateExtension()Creates a new instance. -
SelfSignedCertificateExtension
Creates a new instance.- Parameters:
notBefore
-Certificate
is not valid before this timenotAfter
-Certificate
is not valid after this time
-
SelfSignedCertificateExtension
Creates a new instance.- Parameters:
fqdn
- a fully qualified domain name
-
SelfSignedCertificateExtension
public SelfSignedCertificateExtension(String fqdn, TemporalAccessor notBefore, TemporalAccessor notAfter)Creates a new instance.- Parameters:
fqdn
- a fully qualified domain namenotBefore
-Certificate
is not valid before this timenotAfter
-Certificate
is not valid after this time
-
SelfSignedCertificateExtension
Creates a new instance.- Parameters:
fqdn
- a fully qualified domain namerandom
- theSecureRandom
to usebits
- the number of bits of the generated private key
-
SelfSignedCertificateExtension
public SelfSignedCertificateExtension(String fqdn, SecureRandom random, int bits, TemporalAccessor notBefore, TemporalAccessor notAfter)Creates a new instance.- Parameters:
fqdn
- a fully qualified domain namerandom
- theSecureRandom
to usebits
- the number of bits of the generated private keynotBefore
-Certificate
is not valid before this timenotAfter
-Certificate
is not valid after this time
-
-
Method Details
-
before
Generates aSelfSignedCertificate
.- Specified by:
before
in classAbstractAllOrEachExtension
- Throws:
Exception
-
after
Deletes the generatedSelfSignedCertificate
.- Specified by:
after
in classAbstractAllOrEachExtension
- Throws:
Exception
-
certificate
Returns the generatedX509Certificate
. -
certificateFile
Returns the self-signed certificate file. -
privateKey
Returns thePrivateKey
of the self-signed certificate. -
privateKeyFile
Returns the private key file of the self-signed certificate.
-