diff --git a/pom.xml b/pom.xml
index b937b9c..51c1a4c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -57,20 +57,12 @@
org.springframework.boot
spring-boot-starter-web
-
org.hibernate.validator
hibernate-validator
-
org.springframework.boot
spring-boot-starter-websocket
@@ -119,17 +111,14 @@
org.apache.commons
commons-lang3
-
commons-codec
commons-codec
-
org.apache.httpcomponents
fluent-hc
-
org.projectlombok
@@ -151,13 +140,11 @@
org.mockito
mockito-core
-
test
org.assertj
assertj-core
-
test
@@ -167,7 +154,6 @@
org.apache.maven.plugins
maven-compiler-plugin
-
${java.version}
diff --git a/src/main/java/org/araymond/joal/core/ttorrent/client/announcer/exceptions/TooManyAnnouncesFailedInARawException.java b/src/main/java/org/araymond/joal/core/ttorrent/client/announcer/exceptions/TooMuchAnnouncesFailedInARawException.java
similarity index 100%
rename from src/main/java/org/araymond/joal/core/ttorrent/client/announcer/exceptions/TooManyAnnouncesFailedInARawException.java
rename to src/main/java/org/araymond/joal/core/ttorrent/client/announcer/exceptions/TooMuchAnnouncesFailedInARawException.java
diff --git a/src/main/java/org/araymond/joal/web/config/security/WebSecurityConfig.java b/src/main/java/org/araymond/joal/web/config/security/WebSecurityConfig.java
index c82ceed..8e70183 100644
--- a/src/main/java/org/araymond/joal/web/config/security/WebSecurityConfig.java
+++ b/src/main/java/org/araymond/joal/web/config/security/WebSecurityConfig.java
@@ -2,17 +2,23 @@ package org.araymond.joal.web.config.security;
import org.araymond.joal.web.annotations.ConditionalOnWebUi;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
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.provisioning.InMemoryUserDetailsManager;
+import org.springframework.security.web.DefaultSecurityFilterChain;
+import org.springframework.security.web.SecurityFilterChain;
/**
* Created by raymo on 29/07/2017.
*/
@ConditionalOnWebUi
+@EnableWebSecurity
@Configuration
-public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
+public class WebSecurityConfig {
private final String pathPrefix;
private final boolean shouldDisableFrameOptions;
@@ -24,19 +30,27 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
this.shouldDisableFrameOptions = shouldDisableFrameOptions;
}
- @Override
- protected void configure(final HttpSecurity http) throws Exception {
+ @Bean
+ SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
if (this.shouldDisableFrameOptions) {
http.headers().frameOptions().disable();
}
- http
+ return http
.httpBasic().disable()
+ .formLogin().disable()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
.authorizeRequests()
.antMatchers("/" + this.pathPrefix).permitAll()
.antMatchers("/" + this.pathPrefix + "/ui/**").permitAll()
- .anyRequest().denyAll();
+ .anyRequest().denyAll()
+ .and().build();
+ }
+
+ // Provide an empty UserDetailService to prevent spring from injecting a default one with a valid random password.
+ @Bean
+ public InMemoryUserDetailsManager userDetailsService() {
+ return new InMemoryUserDetailsManager();
}
}