-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdminController.java
More file actions
26 lines (22 loc) · 933 Bytes
/
AdminController.java
File metadata and controls
26 lines (22 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.acon.server.admin.api.controller;
import com.acon.server.admin.api.response.CsrfTokenResponse;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.web.csrf.CsrfToken;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/admin")
public class AdminController {
@GetMapping(path = "/csrf", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<CsrfTokenResponse> getCsrfToken(CsrfToken csrfToken) {
return ResponseEntity.ok(
CsrfTokenResponse.of(
csrfToken.getHeaderName(),
csrfToken.getParameterName(),
csrfToken.getToken()
)
);
}
}