1

I would like to enable or disable the SSL/TLS with external configuration which can be provided during the application startup. The application should support all crud operations for http and https.

## SSL
server.port=8081
server.ssl.key-store=file:C:\\Users\\karthik\\hnm.p12
server.ssl.key-store-password=C*GSYS
server.ssl.keyStoreType=PKCS12

These properties are defined in application.properties

#Spring Security
security.require-ssl=false

Since the above property is deprecated, how can i achieve it without using the profiles.

Karthik Suresh
  • 367
  • 7
  • 23
  • I found the solution in this post : https://stackoverflow.com/questions/49324700/enable-https-with-self-signed-certificate-in-spring-boot-2-0 – Karthik Suresh Mar 10 '20 at 09:04

2 Answers2

2

To disable SSL, you can use:

server.ssl.enabled = false

Have a look at the server properties documentation for details.

cassiomolin
  • 124,154
  • 35
  • 280
  • 359
0

The properties if defined in application.yml

server:
  tomcat:
    accesslog:
      enabled: true
  ssl:
    key-store-type: PKCS12
    key-store: file:C:\\Users\\karthik\\hnm.p12
    enabled: true
    protocol: TLS
    key-store-password: C*GSYS

enabling and disabling the HTTPS can be achieved without code change. Tried and tested in Sprint boot 2.2.4.RELEASE

Karthik Suresh
  • 367
  • 7
  • 23