Я пытаюсь заставить работать SSL. Я сгенерировал свой файл SSL .p12
, и теперь я записал в конфигурации внутри моего application.yml
.
Все еще используется порт 8080
. Почему?
server:
port: 8443
ssl:
key-store: classpath:myFile.p12
key-store-password: myPassword
key-store-type: PKCS12
key-alias: mySSLAlias
key-password: myPassword
И вывод терминала:
Tomcat started on port(s): 8080 (http) with context path ''
Так что я все еще могу подключиться только http://localhost:8080
, а не https://localhost:8443
Почему?
Я также использую Spring Security.
@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
public void configure(HttpSecurity http) throws Exception {
http
.csrf().disable()
.authorizeRequests()
.antMatchers("/Intranet/AdminCrudView", "/Intranet/Bokning").authenticated()
.antMatchers("/**", "/Intranet**").permitAll()
.anyRequest().authenticated()
.and().logout().logoutSuccessUrl("/").permitAll()
.and()
.oauth2Login().defaultSuccessUrl("/Intranet");
}
}
Вот мой полный файл application.yml
:
spring:
datasource:
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/spektrakonhemsida?serverTimezone=CET&createDatabaseIfNotExist=true
username: myUser
password: myPassword
jpa:
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
show-sql: false
hibernate:
ddl-auto: update
security:
oauth2:
client:
registration:
facebook:
clientId: myID
clientSecret: mySecret
accessTokenUri: https://graph.facebook.com/oauth/access_token
userAuthorizationUri: https://www.facebook.com/dialog/oauth
tokenName: oauth_token
authenticationScheme: query
clientAuthenticationScheme: form
resource:
userInfoUri: https://graph.facebook.com/me
mail:
host: smtp.gmail.com
port: 587
username: myGmail@gmail.com
password: myPassword
properties:
mail:
smtp:
auth: true
starttls:
enable: true
crud:
adminfacebookemail: myFacebookEmail@outlook.com
vaadin:
productionMode: true
server:
port: 8443
ssl:
key-store: classpath:mySSLFile.p12
key-store-password: myPassword
key-store-type: PKCS12
key-alias: myAlias
key-password: myPassword