You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

23 lines
662 B

package cc.bnblogs.springsecurity.controller;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class IndexController {
@GetMapping("hello")
public String greet() {
System.out.println("hello");
return "hello";
}
@GetMapping("index")
public Object index(Authentication authentication){
// return SecurityContextHolder.getContext().getAuthentication();
return authentication;
}
}