move user endpoint (#3730)
* move user endpoint * formatting * formatting * formatting * formatting * change url name * Update PersonInfoController.java * Update PersonInfoController.java
This commit is contained in:
committed by
Eugen
parent
76d7e9c49b
commit
07111d1edc
+3
-3
@@ -10,9 +10,9 @@ import com.baeldung.model.Person;
|
||||
@RestController
|
||||
public class PersonInfoController {
|
||||
|
||||
@GetMapping("/personResource")
|
||||
@GetMapping("/person")
|
||||
@PreAuthorize("hasAnyRole('ADMIN', 'USER')")
|
||||
public @ResponseBody Person personInfo() {
|
||||
return new Person("abir", "Dhaka", "Bangladesh", 29, "Male");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.baeldung.controller;
|
||||
|
||||
import java.security.Principal;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* Because this application is also a User Info Resource Server, we expose info about the logged in user at:
|
||||
*
|
||||
* http://localhost:9090/auth/user
|
||||
*/
|
||||
@RestController
|
||||
public class ResourceController {
|
||||
|
||||
@RequestMapping("/user")
|
||||
public Principal user(Principal user) {
|
||||
return user;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user