MOB-42 Changed POST request logic

This commit is contained in:
TanelOrumaa
2021-11-08 23:52:38 +02:00
parent 1d665f02bf
commit 9b0cb1a22d
4 changed files with 38 additions and 23 deletions

View File

@@ -19,7 +19,9 @@ class AuthenticationController {
@PostMapping("authentication", consumes = [MediaType.APPLICATION_JSON_VALUE], produces = [MediaType.APPLICATION_JSON_VALUE])
fun authenticate(@RequestBody authToken : AuthTokenDTO): Authentication {
fun authenticate(@RequestBody body : String): Authentication {
val parts = body.split("\"")
val authToken = AuthTokenDTO(parts[3], parts[7])
// Create Spring Security Authentication object with supplied token as credentials.
val auth = PreAuthenticatedAuthenticationToken(null, authToken)