Skip to content

Commit

Permalink
[SHIBUI-1058]
Browse files Browse the repository at this point in the history
Added simple endpoint to get Principal.

/api/admin/users/current
  • Loading branch information
Bill Smith committed Jan 18, 2019
1 parent 323f6e0 commit 7bbf91a
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.HttpClientErrorException;

import java.security.Principal;
import java.util.List;
import java.util.Optional;

Expand Down Expand Up @@ -54,6 +55,12 @@ public List<User> getAll() {
return userRepository.findAll();
}

@Transactional(readOnly = true)
@GetMapping("/current")
public ResponseEntity<?> getPrincipal(Principal principal) {
return ResponseEntity.ok(principal);
}

@Transactional(readOnly = true)
@GetMapping("/{username}")
public ResponseEntity<?> getOne(@PathVariable String username) {
Expand Down

0 comments on commit 7bbf91a

Please sign in to comment.