BAEL-9148 Fix Java EE Annotations Project
- Removed spring security related code from jee-7 project
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
package com.baeldung.springSecurity;
|
||||
|
||||
import javax.ws.rs.ApplicationPath;
|
||||
import javax.ws.rs.core.Application;
|
||||
|
||||
/**
|
||||
* Application class required by JAX-RS. If you don't want to have any
|
||||
* prefix in the URL, you can set the application path to "/".
|
||||
*/
|
||||
@ApplicationPath("/")
|
||||
public class ApplicationConfig extends Application {
|
||||
|
||||
}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
package com.baeldung.springSecurity;
|
||||
|
||||
import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
|
||||
|
||||
public class SecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer {
|
||||
|
||||
public SecurityWebApplicationInitializer() {
|
||||
super(SpringSecurityConfig.class);
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.baeldung.springSecurity;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
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;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth
|
||||
.inMemoryAuthentication()
|
||||
.withUser("user1")
|
||||
.password("user1Pass")
|
||||
.roles("USER")
|
||||
.and()
|
||||
.withUser("admin")
|
||||
.password("adminPass")
|
||||
.roles("ADMIN");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.csrf()
|
||||
.disable()
|
||||
.authorizeRequests()
|
||||
.antMatchers("/auth/login*")
|
||||
.anonymous()
|
||||
.antMatchers("/home/admin*")
|
||||
.hasRole("ADMIN")
|
||||
.anyRequest()
|
||||
.authenticated()
|
||||
.and()
|
||||
.formLogin()
|
||||
.loginPage("/auth/login")
|
||||
.defaultSuccessUrl("/home", true)
|
||||
.failureUrl("/auth/login?error=true")
|
||||
.and()
|
||||
.logout()
|
||||
.logoutSuccessUrl("/auth/login");
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.baeldung.springSecurity.controller;
|
||||
|
||||
import javax.mvc.annotation.Controller;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/home")
|
||||
@Controller
|
||||
public class HomeController {
|
||||
|
||||
@GET
|
||||
public String home() {
|
||||
return "home.jsp";
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/user")
|
||||
public String admin() {
|
||||
return "user.jsp";
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/admin")
|
||||
public String user() {
|
||||
return "admin.jsp";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.baeldung.springSecurity.controller;
|
||||
|
||||
import javax.mvc.annotation.Controller;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/auth/login")
|
||||
@Controller
|
||||
public class LoginController {
|
||||
|
||||
@GET
|
||||
public String login() {
|
||||
return "login.jsp";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user