This commit is contained in:
parent
17dcc0ac4f
commit
86f4b05b8c
@ -7,14 +7,11 @@ import org.springframework.security.authentication.AuthenticationManager;
|
|||||||
import org.springframework.security.authentication.AuthenticationProvider;
|
import org.springframework.security.authentication.AuthenticationProvider;
|
||||||
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
|
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
|
||||||
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
|
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
|
||||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
import wtf.beatrice.releasehive.repositories.UserRepository;
|
import wtf.beatrice.releasehive.repositories.UserRepository;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class ApplicationConfiguration
|
public class ApplicationConfiguration
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,11 @@ package wtf.beatrice.releasehive.config;
|
|||||||
|
|
||||||
public class InternalConfiguration
|
public class InternalConfiguration
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private InternalConfiguration() {
|
||||||
|
throw new IllegalStateException("Utility class");
|
||||||
|
}
|
||||||
|
|
||||||
public static final String EMAIL_REGEX_RCF = "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])";
|
public static final String EMAIL_REGEX_RCF = "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])";
|
||||||
public static final String USERNAME_REGEX = "^[a-zA-Z0-9_-]{3,16}$";
|
public static final String USERNAME_REGEX = "^[a-zA-Z0-9_-]{3,16}$";
|
||||||
public static final String PASSWORD_REGEX = "^.{6,128}$";
|
public static final String PASSWORD_REGEX = "^.{6,128}$";
|
||||||
|
@ -2,7 +2,6 @@ package wtf.beatrice.releasehive.resources;
|
|||||||
|
|
||||||
import org.apache.coyote.BadRequestException;
|
import org.apache.coyote.BadRequestException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
@ -2,8 +2,6 @@ package wtf.beatrice.releasehive.services;
|
|||||||
|
|
||||||
import org.apache.coyote.BadRequestException;
|
import org.apache.coyote.BadRequestException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.security.authentication.AuthenticationManager;
|
import org.springframework.security.authentication.AuthenticationManager;
|
||||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
@ -11,7 +9,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import wtf.beatrice.releasehive.config.InternalConfiguration;
|
import wtf.beatrice.releasehive.config.InternalConfiguration;
|
||||||
import wtf.beatrice.releasehive.dtos.LoginUserDto;
|
import wtf.beatrice.releasehive.dtos.LoginUserDto;
|
||||||
import wtf.beatrice.releasehive.dtos.RegisterUserDto;
|
import wtf.beatrice.releasehive.dtos.RegisterUserDto;
|
||||||
import wtf.beatrice.releasehive.exceptions.HiveException;
|
|
||||||
import wtf.beatrice.releasehive.models.User;
|
import wtf.beatrice.releasehive.models.User;
|
||||||
import wtf.beatrice.releasehive.repositories.UserRepository;
|
import wtf.beatrice.releasehive.repositories.UserRepository;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user