Relative Content

Tag Archive for javaspringspring-bootspring-mvcspring-security

Facing a spring boot security configuration error

I am creating a user login with verification. But when i was doing the security part i met with an issue.
protected void configure(HttpSecurity http) throws Exception { http .csrf().disable() .authorizeRequests() .antMatchers("/auth/login", "/auth/signup", "/auth/verify").permitAll() .antMatchers(HttpMethod.GET, "/movies/**").permitAll() .anyRequest().authenticated() .and() .addFilter(jwtTokenFilter, UsernamePasswordAuthenticationFilter.class);
Here i get the error of,
“The method addFilter(Filter) in the type HttpSecurity is not applicable for the arguments (JwtTokenFilter, Class)”

PermitAll() is not working for homepage(Spring boot security)

I have a Spring Boot application where I am using multiple projects with Eureka Server. i am trying to access the homepage though the consumer application with the help of Eureka Server but somehow its asking for authentication.
when i provide the login details it redirects me to http://localhost:8082/WEB-INF/pages/homepage.jsp?continue But when i change the URL after the authorization to http://localhost:8082/homepage it displays the Home page(i tried to change the URL before authentication but it doesn’t work it simply redirects me to default login page of Spring Security)

Spring Boot Multiple Type User Authentication with Spring Security System and JWT

ifferent types of users, but I don’t want to create different roles for them. Instead, I will have two different tables: one for staff and one for users. These two types of users will be authenticated with a username and password. Authentication will be handled by separate APIs: one for staff (/api/v1/auth/staff) and one for users (/api/v1/auth/user). After successful authentication, the APIs will be structured as /api/v1/staff/* and /api/v1/students/*.

401 Unauthorized Spring boot with postman

some can help, I don’t understand why when I put this URL “http://localhost:8080/auth/register” or other one, always send me 401 Unauthorized
I have seen a video of youtube and i have followed all the steps and nothing.
I don’t know what to do, this are some of my codes:

Spring Security – Configuration

I’m having a difficult time configuring Spring Security. I’m trying to allow for some routes to be accessible without authentication and secure other routes however .permitAll and .hasRole don’t appear to have an impact on my code. Can someone explain to me what I’m doing wrong and how to resolve it? Thank you. Attached is a snippet of my code.