login working

This commit is contained in:
unknown 2020-05-02 12:39:16 +02:00
parent 04c6247522
commit 1d5744c16e
3 changed files with 9 additions and 4 deletions

View File

@ -8,7 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
public class MvcConfig implements WebMvcConfigurer { public class MvcConfig implements WebMvcConfigurer {
public void addViewControllers(ViewControllerRegistry registry) { public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/addCourse").setViewName("addCourse"); registry.addViewController("/courses").setViewName("addCourse");
registry.addViewController("/").setViewName("start"); registry.addViewController("/").setViewName("start");
registry.addViewController("/login").setViewName("login"); registry.addViewController("/login").setViewName("login");
registry.addViewController("/start").setViewName("start"); registry.addViewController("/start").setViewName("start");

View File

@ -34,9 +34,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override @Override
protected void configure(HttpSecurity http) throws Exception { protected void configure(HttpSecurity http) throws Exception {
http http.authorizeRequests()
.authorizeRequests() .antMatchers( "/", "/courses/**").authenticated()
.antMatchers( "/courses/**").authenticated()
.antMatchers("/", "/register").permitAll() .antMatchers("/", "/register").permitAll()
.antMatchers("/", "/start").authenticated() .antMatchers("/", "/start").authenticated()
//.anyRequest().authenticated() //.anyRequest().authenticated()

View File

@ -7,6 +7,7 @@ import org.imsglobal.lti.launch.LtiSigningException;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -40,6 +41,11 @@ public class StartController {
return "start"; //view return "start"; //view
} }
@GetMapping("")
public String start(){
return "start"; //view
}
} }