-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support @permissionchecker CDI bean methods
- Loading branch information
1 parent
342e6f0
commit 903b9f0
Showing
54 changed files
with
3,000 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...st/java/io/quarkus/resteasy/reactive/server/test/security/BeanParamPermissionChecker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.quarkus.resteasy.reactive.server.test.security; | ||
|
||
import jakarta.enterprise.context.RequestScoped; | ||
|
||
import io.quarkus.security.PermissionChecker; | ||
|
||
@RequestScoped | ||
public class BeanParamPermissionChecker { | ||
|
||
@PermissionChecker("say-hello") | ||
boolean canSayHello(String customAuthorizationHeader, String name, String query) { | ||
boolean queryParamAllowedForPermissionName = checkQueryParams(query); | ||
boolean usernameWhitelisted = isUserNameWhitelisted(name); | ||
boolean customAuthorizationMatches = checkCustomAuthorization(customAuthorizationHeader); | ||
return queryParamAllowedForPermissionName && usernameWhitelisted && customAuthorizationMatches; | ||
} | ||
|
||
static boolean checkCustomAuthorization(String customAuthorization) { | ||
return "customAuthorization".equals(customAuthorization); | ||
} | ||
|
||
static boolean isUserNameWhitelisted(String userName) { | ||
return "admin".equals(userName); | ||
} | ||
|
||
static boolean checkQueryParams(String queryParam) { | ||
return "myQueryParam".equals(queryParam); | ||
} | ||
} |
34 changes: 0 additions & 34 deletions
34
.../quarkus/resteasy/reactive/server/test/security/BeanParamPermissionIdentityAugmentor.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 0 additions & 60 deletions
60
...test/java/io/quarkus/resteasy/reactive/server/test/security/OtherBeanParamPermission.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.