bael-4828: add main source
This commit is contained in:
parent
733ce474a5
commit
86a8634c78
@ -0,0 +1,16 @@
|
|||||||
|
package com.baeldung.tls;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class HomeController {
|
||||||
|
|
||||||
|
@GetMapping("/baeldung")
|
||||||
|
public ResponseEntity<String> welcome() {
|
||||||
|
return new ResponseEntity<>("tls/baeldung", HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.baeldung.tls;
|
||||||
|
|
||||||
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||||
|
|
||||||
|
@EnableWebSecurity
|
||||||
|
public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
|
http.authorizeRequests()
|
||||||
|
.antMatchers("/**")
|
||||||
|
.permitAll();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.baeldung.tls;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.annotation.PropertySource;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class TLSEnabledApplication {
|
||||||
|
|
||||||
|
public static void main(String... args) {
|
||||||
|
SpringApplication application = new SpringApplication(TLSEnabledApplication.class);
|
||||||
|
application.setAdditionalProfiles("tls");
|
||||||
|
application.run(args);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
server.port=8443
|
||||||
|
|
||||||
|
# enable/disable https
|
||||||
|
server.ssl.enabled=true
|
||||||
|
# keystore format
|
||||||
|
server.ssl.key-store-type=PKCS12
|
||||||
|
# keystore location
|
||||||
|
server.ssl.key-store=classpath:keystore/keystore.p12
|
||||||
|
# keystore password
|
||||||
|
server.ssl.key-store-password=changeit
|
||||||
|
server.ssl.key-alias=baeldung
|
||||||
|
# SSL protocol to use
|
||||||
|
server.ssl.protocol=TLS
|
||||||
|
# Enabled SSL protocols
|
||||||
|
server.ssl.enabled-protocols=TLSv1.2
|
||||||
|
|
||||||
|
#server.ssl.client-auth=need
|
||||||
|
|
||||||
|
#trust store location
|
||||||
|
#server.ssl.trust-store=classpath:keystore/truststore.p12
|
||||||
|
#trust store password
|
||||||
|
#server.ssl.trust-store-password=changeit
|
Loading…
x
Reference in New Issue
Block a user