You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: security-memory-http-basic-api/readme.md
+56
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,62 @@ The userName and password is encoded in the format `username:password`. This is
24
24
25
25
In case of basic authentication, the username and password is only encoded with Base64, but not encrypted or hashed in any way. Hence, it can be compromised by any man in the middle. Hence, it is always recommended to authenticate rest API calls by this header over a ssl connection.
26
26
27
+
## Permissions
28
+
29
+
In this implementation, we are not limited to roles ("ROLE_ADMIN" or "ROLE_USER").
30
+
31
+
Here we need a distinction at the level of rules (privileges).
32
+
33
+
In particular, REST has the ability to read as well as write.
34
+
35
+
In this project create permissions for REST company:
36
+
37
+
```
38
+
public enum Permissions {
39
+
40
+
COMPANY_VIEW("company#V"), // GET
41
+
COMPANY_EDIT("company#E"), // PATCH or PUT
42
+
COMPANY_CREATE("company#C"); // POST or DELETE
43
+
44
+
private final String permissionString;
45
+
46
+
private Permissions(String permissionString) {
47
+
this.permissionString = permissionString;
48
+
}
49
+
50
+
public String getValue() {
51
+
return permissionString;
52
+
}
53
+
54
+
}
55
+
```
56
+
57
+
or of course you can create permissions to all CRUD operations, like this:
Copy file name to clipboardExpand all lines: test-security-memory-basic-rest/readme.md
+56
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,62 @@ The userName and password is encoded in the format `username:password`. This is
24
24
25
25
In case of basic authentication, the username and password is only encoded with Base64, but not encrypted or hashed in any way. Hence, it can be compromised by any man in the middle. Hence, it is always recommended to authenticate rest API calls by this header over a ssl connection.
26
26
27
+
## Permissions
28
+
29
+
In this implementation, we are not limited to roles ("ROLE_ADMIN" or "ROLE_USER").
30
+
31
+
Here we need a distinction at the level of rules (privileges).
32
+
33
+
In particular, REST has the ability to read as well as write.
34
+
35
+
In this project create permissions for REST company:
36
+
37
+
```
38
+
public enum Permissions {
39
+
40
+
COMPANY_VIEW("company#V"), // GET
41
+
COMPANY_EDIT("company#E"), // PATCH or PUT
42
+
COMPANY_CREATE("company#C"); // POST or DELETE
43
+
44
+
private final String permissionString;
45
+
46
+
private Permissions(String permissionString) {
47
+
this.permissionString = permissionString;
48
+
}
49
+
50
+
public String getValue() {
51
+
return permissionString;
52
+
}
53
+
54
+
}
55
+
```
56
+
57
+
or of course you can create permissions to all CRUD operations, like this:
0 commit comments