Implement persistent session storage

Signed-off-by: Billy Brawner <billy@wbrawner.com>
This commit is contained in:
Billy Brawner 2019-10-19 15:14:06 -07:00
parent 5d7470a006
commit 4755b30a11
3 changed files with 13 additions and 0 deletions

View file

@ -28,6 +28,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>

View file

@ -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<UserResponse> {
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"])

View file

@ -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