Class GrpcServerProperties.Security

java.lang.Object
net.devh.boot.grpc.server.config.GrpcServerProperties.Security
Enclosing class:
GrpcServerProperties

public static class GrpcServerProperties.Security extends Object
The security configuration for the gRPC server.
  • Constructor Details

    • Security

      public Security()
  • Method Details

    • setCiphers

      public void setCiphers(String ciphers)
    • setProtocols

      public void setProtocols(String protocols)
    • isEnabled

      public boolean isEnabled()
      Flag that controls whether transport security is used. Defaults to false. If true, either set certificateChain and privateKey, or keyStore.
      Returns:
      True, if transport security should be enabled. False otherwise.
    • getCertificateChain

      public Resource getCertificateChain()
      The resource containing the SSL certificate chain. Use is combination with privateKey. Cannot be used in conjunction with keyStore.
      Returns:
      The certificate chain resource or null.
      See Also:
      • GrpcSslContexts.forServer(InputStream, InputStream, String)
    • getPrivateKey

      public Resource getPrivateKey()
      The resource containing the private key. Use in combination with certificateChain. Cannot be used in conjunction with keyStore.
      Returns:
      The private key resource or null.
      See Also:
      • GrpcSslContexts.forServer(InputStream, InputStream, String)
    • getPrivateKeyPassword

      public String getPrivateKeyPassword()
      Password for the private key. Use is combination with privateKey.
      Returns:
      The password for the private key or null.
      See Also:
      • GrpcSslContexts.forServer(File, File, String)
    • getKeyStoreFormat

      public String getKeyStoreFormat()
      The format of the keyStore.

      Possible values includes:

      • AUTODETECT (default)
      • JKS (.jks)
      • PKCS12 (.p12)
      • any supported KeyStore format
      • Fallback to KeyStore#getDefaultType()
      Returns:
      The trust store format to use.
    • getKeyStore

      public Resource getKeyStore()
      The resource containing the key store. Cannot be used in conjunction with privateKey.
      Returns:
      The key store resource or null.
    • getKeyStorePassword

      public String getKeyStorePassword()
      Password for the key store. Use is combination with keyStore.
      Returns:
      The password for the key store or null.
    • getClientAuth

      public ClientAuth getClientAuth()
      Whether the client has to authenticate himself via certificates. Can be either of NONE, OPTIONAL or REQUIRE. Defaults to ClientAuth.NONE.
      Returns:
      Whether the client has to authenticate himself via certificates.
      See Also:
      • SslContextBuilder#clientAuth(ClientAuth)
    • getTrustCertCollection

      public Resource getTrustCertCollection()
      The resource containing the trusted certificate collection. Cannot be used in conjunction with trustStore. If neither this nor trustCertCollection is set then the system's trust store will be used.
      Returns:
      The trusted certificate collection resource or null.
      See Also:
      • SslContextBuilder.trustManager(InputStream)
    • getTrustStoreFormat

      public String getTrustStoreFormat()
      The format of the trustStore.

      Possible values includes:

      • AUTODETECT (default)
      • JKS (.jks)
      • PKCS12 (.p12)
      • any supported KeyStore format
      • Fallback to KeyStore#getDefaultType()
      Returns:
      The trust store format to use.
    • getTrustStore

      public Resource getTrustStore()
      The resource containing the trust store. Cannot be used in conjunction with trustCertCollection. If neither this nor trustCertCollection is set then the system's trust store will be used.
      Returns:
      The trust store resource or null.
    • getTrustStorePassword

      public String getTrustStorePassword()
      Password for the trust store. Use is combination with trustStore.
      Returns:
      The password for the trust store or null.
    • getCiphers

      public List<String> getCiphers()
      Specifies the cipher suite. If null or empty it will use the system's default cipher suite.
      Returns:
      The cipher suite accepted for secure connections or null.
    • getProtocols

      public String[] getProtocols()
      Specifies the protocols accepted for secure connections. If null or empty it will use the system's default (all supported) protocols.
      Returns:
      The protocols accepted for secure connections or null.
    • setEnabled

      public void setEnabled(boolean enabled)
      Flag that controls whether transport security is used. Defaults to false. If true, either set certificateChain and privateKey, or keyStore.
      Parameters:
      enabled - Whether transport security should be enabled.
    • setCertificateChain

      public void setCertificateChain(Resource certificateChain)
      The resource containing the SSL certificate chain. Use is combination with privateKey. Cannot be used in conjunction with keyStore.
      Parameters:
      certificateChain - The certificate chain resource.
      See Also:
      • GrpcSslContexts.forServer(InputStream, InputStream, String)
    • setPrivateKey

      public void setPrivateKey(Resource privateKey)
      The resource containing the private key. Use in combination with certificateChain. Cannot be used in conjunction with keyStore.
      Parameters:
      privateKey - The private key resource.
      See Also:
      • GrpcSslContexts.forServer(InputStream, InputStream, String)
    • setPrivateKeyPassword

      public void setPrivateKeyPassword(String privateKeyPassword)
      Password for the private key. Use is combination with privateKey.
      Parameters:
      privateKeyPassword - The password for the private key.
      See Also:
      • GrpcSslContexts.forServer(File, File, String)
    • setKeyStoreFormat

      public void setKeyStoreFormat(String keyStoreFormat)
      The format of the keyStore.

      Possible values includes:

      • AUTODETECT (default)
      • JKS (.jks)
      • PKCS12 (.p12)
      • any supported KeyStore format
      • Fallback to KeyStore#getDefaultType()
      Parameters:
      keyStoreFormat - The trust store format to use.
    • setKeyStore

      public void setKeyStore(Resource keyStore)
      The resource containing the key store. Cannot be used in conjunction with privateKey.
      Parameters:
      keyStore - The key store resource.
    • setKeyStorePassword

      public void setKeyStorePassword(String keyStorePassword)
      Password for the key store. Use is combination with keyStore.
      Parameters:
      keyStorePassword - The password for the key store.
    • setClientAuth

      public void setClientAuth(ClientAuth clientAuth)
      Whether the client has to authenticate himself via certificates. Can be either of NONE, OPTIONAL or REQUIRE. Defaults to ClientAuth.NONE.
      Parameters:
      clientAuth - Whether the client has to authenticate himself via certificates.
      See Also:
      • SslContextBuilder#clientAuth(ClientAuth)
    • setTrustCertCollection

      public void setTrustCertCollection(Resource trustCertCollection)
      The resource containing the trusted certificate collection. Cannot be used in conjunction with trustStore. If neither this nor trustCertCollection is set then the system's trust store will be used.
      Parameters:
      trustCertCollection - The trusted certificate collection resource.
      See Also:
      • SslContextBuilder.trustManager(InputStream)
    • setTrustStoreFormat

      public void setTrustStoreFormat(String trustStoreFormat)
      The format of the trustStore.

      Possible values includes:

      • AUTODETECT (default)
      • JKS (.jks)
      • PKCS12 (.p12)
      • any supported KeyStore format
      • Fallback to KeyStore#getDefaultType()
      Parameters:
      trustStoreFormat - The trust store format to use.
    • setTrustStore

      public void setTrustStore(Resource trustStore)
      The resource containing the trust store. Cannot be used in conjunction with trustCertCollection. If neither this nor trustCertCollection is set then the system's trust store will be used.
      Parameters:
      trustStore - The trust store resource.
    • setTrustStorePassword

      public void setTrustStorePassword(String trustStorePassword)
      Password for the trust store. Use is combination with trustStore.
      Parameters:
      trustStorePassword - The password for the trust store.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object