Merge pull request #10575 from hmdrzsharifi/BAEL-4828
Bael-4828-This Combination of Host and Port Requires TLS
This commit is contained in:
commit
6c137858d6
|
@ -31,6 +31,7 @@
|
|||
<module>spring-security-web-angular/server</module>
|
||||
<module>spring-security-web-boot-1</module>
|
||||
<module>spring-security-web-boot-2</module>
|
||||
<module>spring-security-web-boot-3</module>
|
||||
<module>spring-security-web-digest-auth</module>
|
||||
<module>spring-security-web-login</module>
|
||||
<module>spring-security-web-mvc-custom</module>
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
## Spring Boot Security MVC
|
||||
|
||||
This module contains articles about Spring Security with Spring MVC in Boot applications
|
||||
|
||||
### The Course
|
||||
The "REST With Spring" Classes: http://github.learnspringsecurity.com
|
||||
|
||||
### Relevant Articles:
|
||||
|
||||
- [TLS Setup in Spring](https://www.baeldung.com/)
|
||||
- More articles: [[<-- prev]](/spring-security-modules/spring-security-web-boot-2)
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>spring-security-web-boot-3</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>spring-security-web-boot-3</name>
|
||||
<packaging>jar</packaging>
|
||||
<description>Spring Security MVC Boot - 3</description>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -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
|
|
@ -0,0 +1,28 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIExzCCAq+gAwIBAgIEbh/WszANBgkqhkiG9w0BAQsFADAUMRIwEAYDVQQDEwls
|
||||
b2NhbGhvc3QwHhcNMjEwMzIxMDgzMzU3WhcNMzEwMzE5MDgzMzU3WjAUMRIwEAYD
|
||||
VQQDEwlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCD
|
||||
QWvAEewDE+vFFqYPgXFJ94bMgPZT6qdb17DkWWbL2jV5QENbSYTLAPNQ1TGUgKhj
|
||||
t1LCHpooLwWIo6xvhK/qZYjh3YonSIe8Eo0fBCDoZpLO+Vp0us22NBgLOYH8hvAm
|
||||
zEvPXdSZo5Qkeaqjwd6kB/z083y8OL+Civ0ARXoLsn7CFslKfZp2o/aebH6i/T+3
|
||||
hWVqasIIMtfNUrxE/pnOnV8aSAt24jcm/VxbtheqIzmcOPlCXSP1RAmFez6tJsNu
|
||||
2dbUhaeOf95RCaM6a43soEvLvooGa/uqBPsRojg5WEFGf7Tc7pzB+BtALwRmHAqr
|
||||
hiYjVv329QGZ+g8dADBvvqvGpGysy+X0LxixvIP14KdCqG8uMYmw5cBTJHc23AHV
|
||||
iP+JsfDtdu+bzZeOZmhSsv4M3DZ1QPHEX+zCnotE+SeycqEr+3SaJELyjCB1twFT
|
||||
pCRCQGWFKYCRwhjQ1vGY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|
||||
-----END CERTIFICATE-----
|
Binary file not shown.
Loading…
Reference in New Issue