mirror of
https://gitlab.com/etc404/software-engineering-project.git
synced 2026-05-10 20:52:58 +00:00
User password override, re-enabled login page.
This commit is contained in:
@@ -3,17 +3,29 @@ package com.example.demo.config;
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
|
import org.springframework.security.core.userdetails.User;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
|
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
|
||||||
import org.springframework.security.web.SecurityFilterChain;
|
import org.springframework.security.web.SecurityFilterChain;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class SecurityConfig {
|
public class SecurityConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
public UserDetailsService userDetailsService() {
|
||||||
http.csrf(csrf -> csrf.disable())
|
UserDetails user = User.builder()
|
||||||
.authorizeHttpRequests(auth -> auth
|
.username("admin")
|
||||||
.anyRequest().permitAll()
|
.password("{noop}password")
|
||||||
);
|
.build();
|
||||||
return http.build();
|
return new InMemoryUserDetailsManager(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Bean
|
||||||
|
// public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||||
|
// http.csrf(csrf -> csrf.disable())
|
||||||
|
// .authorizeHttpRequests(auth -> auth
|
||||||
|
// .anyRequest().permitAll()
|
||||||
|
// );
|
||||||
|
// return http.build();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user