forked from SAP-archive/cloud-application-security-sample
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAttributeFinder.java
More file actions
37 lines (30 loc) · 1.21 KB
/
AttributeFinder.java
File metadata and controls
37 lines (30 loc) · 1.21 KB
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
27
28
29
30
31
32
33
34
35
36
37
package com.sap.cp.appsec.controllers;
import com.sap.cp.appsec.domain.ConfidentialityLevel;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@RestController
@RequestMapping(AttributeFinder.PATH)
public class AttributeFinder {
public static final String ATTRIBUTE_CONFIDENTIALITY_LEVEL = ConfidentialityLevel.ATTRIBUTE_NAME;
static final String PATH = "/api/v1/attribute";
@GetMapping("/{ATTRIBUTE_NAME}")
public List<String> getAllValuesForAttribute(@PathVariable("ATTRIBUTE_NAME") String attributeName) {
switch (attributeName) {
case ATTRIBUTE_CONFIDENTIALITY_LEVEL:
return ConfidentialityLevel.getValues();
default:
return Collections.emptyList();
}
}
@GetMapping
public List<String> getAllAttributes() {
List<String> attributes = new ArrayList<>();
attributes.add(ATTRIBUTE_CONFIDENTIALITY_LEVEL);
return attributes;
}
}