Это моя WebSecurityConfig
Код: Выделить всё
Customizer logoutConfigurerCustomizer = httpSecurityLogoutConfigurer -> {
httpSecurityLogoutConfigurer.deleteCookies("JSESSIONID");
httpSecurityLogoutConfigurer.permitAll();
};
Customizer sessionManagementConfigurerCustomizer =
httpSecuritySessionManagementConfigurer ->
httpSecuritySessionManagementConfigurer.maximumSessions(1);
http
.csrf(AbstractHttpConfigurer::disable)
.exceptionHandling(exception -> exception.authenticationEntryPoint(unauthorizedHandler))
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.authorizeHttpRequests(auth ->
auth.requestMatchers("/prog/auth/**").permitAll()
.requestMatchers("/prog/url/**").hasAnyAuthority("AUTH1","AUTH2")
Код: Выделить всё
@RestController
@RequestMapping("/auth")
public class AuthController {
//...
@CrossOrigin(origins = "*")
@PostMapping("/signin")
public ResponseEntity authenticateUser(@Valid @RequestBody LoginRequest loginRequest) {
logger.info("Login");
try {
authenticationManager.authenticate(
new UsernamePasswordAuthenticationToken(
loginRequest.getUsername(),
loginRequest.getPassword()
)
);
//...
Код: Выделить всё
org.wildfly.plugins
wildfly-maven-plugin
5.0.0.Final
Код: Выделить всё
http://localhost:8080/prog/auth/signin (POST method)
Подробнее здесь: https://stackoverflow.com/questions/790 ... -supported
Мобильная версия