- java.lang.Object
-
- io.javalin.community.ssl.TrustConfig
-
public class TrustConfig extends java.lang.ObjectConfiguration for the trust store, used to verify the identity of the clients. Using this configuration, the server will only accept connections from clients that are trusted. If no trust store is configured, the server will accept any client.
-
-
Field Summary
Fields Modifier and Type Field Description java.util.List<java.security.cert.Certificate>certificatesList of certificates to be trusted, can be loaded using the helper methods or directly.java.util.List<java.security.KeyStore>keyStoresList of KeyStores to be trusted, can be loaded using the helper methods or directly.
-
Constructor Summary
Constructors Constructor Description TrustConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcertificateFromClasspath(java.lang.String certificateFile)Load certificate data from the classpath.voidcertificateFromInputStream(java.io.InputStream certificateInputStream)Load certificate data from a given input stream.voidcertificateFromPath(java.lang.String certificatePath)Load certificate data from a given path in the system.voidp7bCertificateFromString(java.lang.String certificateString)Load P7B certificate data from a given string.voidpemFromString(java.lang.String certificateString)Load pem formatted identity data from a given string.voidtrustStoreFromClasspath(java.lang.String trustStoreFile, java.lang.String trustStorePassword)Load a trust store from the classpath.voidtrustStoreFromInputStream(java.io.InputStream trustStoreInputStream, java.lang.String trustStorePassword)Load a trust store from a given input stream.voidtrustStoreFromPath(java.lang.String trustStorePath, java.lang.String trustStorePassword)Load a trust store from a given path in the system.
-
-
-
Field Detail
-
certificates
public java.util.List<java.security.cert.Certificate> certificates
List of certificates to be trusted, can be loaded using the helper methods or directly. This list is complementary to the keys
-
keyStores
public java.util.List<java.security.KeyStore> keyStores
List of KeyStores to be trusted, can be loaded using the helper methods or directly.
-
-
Method Detail
-
certificateFromPath
public void certificateFromPath(java.lang.String certificatePath)
Load certificate data from a given path in the system. The certificate can be in PEM, P7B/PKCS#7 or DER format.- Parameters:
certificatePath- path to the certificate file.
-
certificateFromClasspath
public void certificateFromClasspath(java.lang.String certificateFile)
Load certificate data from the classpath. The certificate can be in PEM, P7B/PKCS#7 or DER format.- Parameters:
certificateFile- The name of the certificate file in the classpath.
-
certificateFromInputStream
public void certificateFromInputStream(java.io.InputStream certificateInputStream)
Load certificate data from a given input stream. The certificate can be in PEM, P7B/PKCS#7 or DER format.- Parameters:
certificateInputStream- input stream to the certificate file.
-
p7bCertificateFromString
public void p7bCertificateFromString(java.lang.String certificateString)
Load P7B certificate data from a given string. The certificate must be in P7B/PKCS#7 format.- Parameters:
certificateString- P7B encoded certificate.
-
pemFromString
public void pemFromString(java.lang.String certificateString)
Load pem formatted identity data from a given string. The certificate must be in PEM format.- Parameters:
certificateString- PEM encoded certificate.
-
trustStoreFromPath
public void trustStoreFromPath(java.lang.String trustStorePath, java.lang.String trustStorePassword)Load a trust store from a given path in the system. The trust store can be in JKS or PKCS12 format.- Parameters:
trustStorePath- path to the trust store file.trustStorePassword- password for the trust store.
-
trustStoreFromInputStream
public void trustStoreFromInputStream(java.io.InputStream trustStoreInputStream, java.lang.String trustStorePassword)Load a trust store from a given input stream. The trust store can be in JKS or PKCS12 format.- Parameters:
trustStoreInputStream- input stream to the trust store file.trustStorePassword- password for the trust store.
-
trustStoreFromClasspath
public void trustStoreFromClasspath(java.lang.String trustStoreFile, java.lang.String trustStorePassword)Load a trust store from the classpath.- Parameters:
trustStoreFile- The name of the trust store file in the classpath.trustStorePassword- password for the trust store.
-
-