- Update the Spring-Security-code to use the "SecurityFilterChain", as the previous code was deprecated.

- Update dependencies.
This commit is contained in:
Lampros Smyrnaios 2022-06-27 21:41:32 +03:00
parent e3b374a32f
commit a2cd02115f
2 changed files with 11 additions and 14 deletions

View File

@ -1,5 +1,5 @@
plugins {
id 'org.springframework.boot' version '2.7.0'
id 'org.springframework.boot' version '2.7.1'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
@ -32,10 +32,10 @@ dependencies {
implementation("org.springframework.security:spring-security-web")
implementation("org.springframework.security:spring-security-config")
//implementation("io.jsonwebtoken:jjwt:0.9.1") // Use this in case we use auth-tokens later on.
//implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5' // Use this in case we use auth-tokens later on.
// Enable the validation annotations.
//implementation group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
//implementation group: 'jakarta.validation', name: 'jakarta.validation-api', version: '3.0.2'
implementation "org.projectlombok:lombok:1.18.24"
@ -45,7 +45,7 @@ dependencies {
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
implementation 'io.minio:minio:8.4.1'
implementation 'io.minio:minio:8.4.2'
// https://mvnrepository.com/artifact/com.cloudera.impala/jdbc
implementation("com.cloudera.impala:jdbc:2.5.31") {

View File

@ -1,13 +1,12 @@
package eu.openaire.urls_controller.security;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
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;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.SecurityFilterChain;
@Configuration
@ -17,14 +16,10 @@ import org.springframework.security.config.http.SessionCreationPolicy;
jsr250Enabled = true,
prePostEnabled = true
)
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
public class SecurityConfiguration {
private static final Logger logger = LoggerFactory.getLogger(SecurityConfiguration.class);
// Defines which resources are public and which are secured.
@Override
protected void configure(HttpSecurity http) throws Exception {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.headers()
.frameOptions()
@ -46,5 +41,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
//.requiresChannel()
//.anyRequest().requiresSecure()
;
return http.build();
}
}