Add simple auth
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package com.aiteacher.auth;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.security.Principal;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/auth")
|
||||
public class AuthController {
|
||||
|
||||
@GetMapping("/check")
|
||||
public ResponseEntity<Map<String, String>> check(Principal principal) {
|
||||
return ResponseEntity.ok(Map.of("username", principal.getName()));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user