diff --git a/pom.xml b/pom.xml index 12663d7..cc8498e 100644 --- a/pom.xml +++ b/pom.xml @@ -28,6 +28,10 @@ org.springframework.boot spring-boot-starter-security + + org.springframework.session + spring-session-jdbc + org.springframework.boot spring-boot-starter-web diff --git a/src/main/kotlin/com/wbrawner/budgetserver/user/UserController.kt b/src/main/kotlin/com/wbrawner/budgetserver/user/UserController.kt index e3b9498..34f0878 100644 --- a/src/main/kotlin/com/wbrawner/budgetserver/user/UserController.kt +++ b/src/main/kotlin/com/wbrawner/budgetserver/user/UserController.kt @@ -51,6 +51,13 @@ class UserController @Autowired constructor( return ResponseEntity.ok(UserResponse(getCurrentUser()!!)) } + @GetMapping("/me", produces = [MediaType.APPLICATION_JSON_VALUE]) + @ApiOperation(value = "getProfile", nickname = "getProfile", tags = ["Users"]) + fun getProfile(): ResponseEntity { + val user = getCurrentUser()?: return ResponseEntity.status(401).build() + return ResponseEntity.ok(UserResponse(user)) + } + @Transactional @GetMapping("/search", produces = [MediaType.APPLICATION_JSON_VALUE]) @ApiOperation(value = "searchUsers", nickname = "searchUsers", tags = ["Users"]) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index fb4bb76..e53683b 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -4,3 +4,5 @@ spring.datasource.username=budget spring.datasource.password=budget spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.profiles.active=prod +spring.session.store-type=jdbc +spring.session.jdbc.initialize-schema=always