Search in sources :

Example 6 with AuthenticationUser

use of com.yahoo.elide.spring.security.AuthenticationUser in project elide by yahoo.

the class JsonApiController method elideDelete.

@DeleteMapping(value = "/**")
public Callable<ResponseEntity<String>> elideDelete(@RequestHeader HttpHeaders requestHeaders, @RequestParam MultiValueMap<String, String> allRequestParams, HttpServletRequest request, Authentication authentication) {
    final String apiVersion = HeaderUtils.resolveApiVersion(requestHeaders);
    final Map<String, List<String>> requestHeadersCleaned = HeaderUtils.lowercaseAndRemoveAuthHeaders(requestHeaders);
    final String pathname = getJsonApiPath(request, settings.getJsonApi().getPath());
    final User user = new AuthenticationUser(authentication);
    final String baseUrl = getBaseUrlEndpoint();
    return new Callable<ResponseEntity<String>>() {

        @Override
        public ResponseEntity<String> call() throws Exception {
            ElideResponse response = elide.delete(baseUrl, pathname, null, convert(allRequestParams), requestHeadersCleaned, user, apiVersion, UUID.randomUUID());
            return ResponseEntity.status(response.getResponseCode()).body(response.getBody());
        }
    };
}
Also used : User(com.yahoo.elide.core.security.User) AuthenticationUser(com.yahoo.elide.spring.security.AuthenticationUser) ElideResponse(com.yahoo.elide.ElideResponse) List(java.util.List) AuthenticationUser(com.yahoo.elide.spring.security.AuthenticationUser) Callable(java.util.concurrent.Callable) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping)

Aggregations

ElideResponse (com.yahoo.elide.ElideResponse)6 User (com.yahoo.elide.core.security.User)6 AuthenticationUser (com.yahoo.elide.spring.security.AuthenticationUser)6 List (java.util.List)6 Callable (java.util.concurrent.Callable)6 DeleteMapping (org.springframework.web.bind.annotation.DeleteMapping)2 PostMapping (org.springframework.web.bind.annotation.PostMapping)2 Elide (com.yahoo.elide.Elide)1 InvalidOperationException (com.yahoo.elide.core.exceptions.InvalidOperationException)1 QueryRunner (com.yahoo.elide.graphql.QueryRunner)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1 PatchMapping (org.springframework.web.bind.annotation.PatchMapping)1