Skip to content

Commit 0bd2ec3

Browse files
committed
Refactored the project.
1 parent d95e0b0 commit 0bd2ec3

File tree

17 files changed

+137
-684
lines changed

17 files changed

+137
-684
lines changed

.mvn/wrapper/MavenWrapperDownloader.java

Lines changed: 0 additions & 114 deletions
This file was deleted.

.mvn/wrapper/maven-wrapper.jar

-47.2 KB
Binary file not shown.

.mvn/wrapper/maven-wrapper.properties

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ service ExampleService {
8585
8686
message Empty {}
8787
message GetExample {
88-
string userId = 1;
88+
string ownerField = 1;
8989
}
9090
```
9191

@@ -124,12 +124,12 @@ We know 2 types of annotation: `@Allow` and `@Expose`
124124

125125
#### `@Allow`
126126
* `roles` -> Algorithm used for signing the JWT token. Default: `HmacSHA256`
127-
* `ownerField` -> Example: `userId`. _Optional field_. Your request will be parsed and if the mentioned field is found, it will compare equality with JWT token subject(e.g.: userId). By this comparison, you can be sure that any operation with that field is made by the owner of the token. If the fields don't match and data are owned by another user, specified roles will be checked after.
127+
* `ownerField` -> Example: `ownerField`. _Optional field_. Your request will be parsed and if the mentioned field is found, it will compare equality with JWT token subject(e.g.: ownerField). By this comparison, you can be sure that any operation with that field is made by the owner of the token. If the fields don't match and data are owned by another user, specified roles will be checked after.
128128

129129

130130
_**Example use case of `ownerField`**: Imagine, you want to list purchased orders of some user.
131131
You might want to reuse the exact same API for back-office and also for that particular user who created the orders.
132-
With `ownerField` you can check for the owner and also for some role if owner userId in JWT token is different._
132+
With `ownerField` you can check for the owner and also for some role if owner ownerField in JWT token is different._
133133

134134
#### `@Exposed`
135135
* `environments` List of environments (Spring Profiles) where you can access the gRPC without checking for owner or roles.
@@ -139,7 +139,7 @@ Use case: Debug endpoint for the client/front-end development team.
139139
@GRpcService
140140
public class ExampleServiceImpl extends ExampleServiceGrpc.ExampleServiceImplBase {
141141

142-
@Allow(ownerField="userId", roles = GrpcRole.INTERNAL)
142+
@Allow(ownerField="ownerField", roles = GrpcRole.INTERNAL)
143143
@Exposed(environments={"dev","qa"})
144144
public void getExample(GetExample request, StreamObserver<Empty> response) {
145145
//...

0 commit comments

Comments
 (0)