You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by GitBox <gi...@apache.org> on 2021/01/18 20:43:52 UTC
[GitHub] [geronimo-jwt-auth] dabloem opened a new pull request #5: alternative group claim
dabloem opened a new pull request #5:
URL: https://github.com/apache/geronimo-jwt-auth/pull/5
@rmannibucau please review and feedback
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geronimo-jwt-auth] rmannibucau commented on a change in pull request #5: alternative group claim
Posted by GitBox <gi...@apache.org>.
rmannibucau commented on a change in pull request #5:
URL: https://github.com/apache/geronimo-jwt-auth/pull/5#discussion_r560033099
##########
File path: src/main/java/org/apache/geronimo/microprofile/impl/jwtauth/servlet/JwtRequest.java
##########
@@ -132,6 +139,20 @@ public Principal getUserPrincipal() {
@Override
public boolean isUserInRole(final String role) {
+ if (tokenExtractor.get().containsClaim(groupsName)) {
+ JsonValue jsonValue = tokenExtractor.get().getClaim(groupsName);
+ Set<String> groups = Collections.EMPTY_SET;
+ if (jsonValue.getValueType() == JsonValue.ValueType.ARRAY) {
+ groups = JsonArray.class.cast(jsonValue).stream()
Review comment:
asJsonArray?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geronimo-jwt-auth] dabloem commented on pull request #5: alternative group claim
Posted by GitBox <gi...@apache.org>.
dabloem commented on pull request #5:
URL: https://github.com/apache/geronimo-jwt-auth/pull/5#issuecomment-763474859
Aha, thanks.
To be honest, I didn't know about javax.json.JsonPatch class. I thought more of 'allowing' a JsonPatch, therefor I came up with the JsonPatchProcessor.class.
So, we had both the preference for JsonPatch ;-)
I will take a look, and see if I can make a test...
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geronimo-jwt-auth] dabloem commented on a change in pull request #5: alternative group claim
Posted by GitBox <gi...@apache.org>.
dabloem commented on a change in pull request #5:
URL: https://github.com/apache/geronimo-jwt-auth/pull/5#discussion_r560239630
##########
File path: src/main/java/org/apache/geronimo/microprofile/impl/jwtauth/servlet/JwtRequest.java
##########
@@ -132,6 +139,20 @@ public Principal getUserPrincipal() {
@Override
public boolean isUserInRole(final String role) {
+ if (tokenExtractor.get().containsClaim(groupsName)) {
+ JsonValue jsonValue = tokenExtractor.get().getClaim(groupsName);
+ Set<String> groups = Collections.EMPTY_SET;
+ if (jsonValue.getValueType() == JsonValue.ValueType.ARRAY) {
+ groups = JsonArray.class.cast(jsonValue).stream()
Review comment:
done
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geronimo-jwt-auth] rmannibucau commented on pull request #5: alternative group claim
Posted by GitBox <gi...@apache.org>.
rmannibucau commented on pull request #5:
URL: https://github.com/apache/geronimo-jwt-auth/pull/5#issuecomment-762974953
1. Define a jsonpatch (JsonPatch class) and apply it on the token to get the one used after raw extraction by the runtime. Enables this mapping and more.
2. Our impl does and spec too due to kid support so we must keep it or not add this facility (since it is already doable through other ways)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geronimo-jwt-auth] rmannibucau commented on pull request #5: alternative group claim
Posted by GitBox <gi...@apache.org>.
rmannibucau commented on pull request #5:
URL: https://github.com/apache/geronimo-jwt-auth/pull/5#issuecomment-762985899
@dabloem not really tested but to share the idea: https://github.com/apache/geronimo-jwt-auth/commit/2f4ab7212d3587f58be64b6d98bc678ddddaf788. We can add any needed strategy in the patcher bean (like flattening groups from string or so. Note that being protected the patch impl can trivially be enhanced in any app. Hope it helps.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geronimo-jwt-auth] dabloem commented on pull request #5: alternative group claim
Posted by GitBox <gi...@apache.org>.
dabloem commented on pull request #5:
URL: https://github.com/apache/geronimo-jwt-auth/pull/5#issuecomment-762896321
> Hi, two open questions:
>
> 1. What about jsonpatch option instead of group alias? Sounds saner to me
> 2. Wat about multi key/jwt apps, shouldnt it be a map with the keyid as key (with a default)?
> Otherwise looks good
1. I don't fully understand what you mean. Maybe a simple gist?
2. I don't know. I haven't seen it in other impl's (smallrye-liberty). And, is there such a use case, that the same app, receives different jwt's, signed with the same private key?
What I do like, is the hierarchy to locatie the groups claim. The example Token1.json in the tck includes an example with customObject.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geronimo-jwt-auth] dabloem commented on a change in pull request #5: alternative group claim
Posted by GitBox <gi...@apache.org>.
dabloem commented on a change in pull request #5:
URL: https://github.com/apache/geronimo-jwt-auth/pull/5#discussion_r560239726
##########
File path: src/main/java/org/apache/geronimo/microprofile/impl/jwtauth/servlet/JwtRequest.java
##########
@@ -132,6 +139,20 @@ public Principal getUserPrincipal() {
@Override
public boolean isUserInRole(final String role) {
+ if (tokenExtractor.get().containsClaim(groupsName)) {
Review comment:
done
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geronimo-jwt-auth] rmannibucau commented on pull request #5: alternative group claim
Posted by GitBox <gi...@apache.org>.
rmannibucau commented on pull request #5:
URL: https://github.com/apache/geronimo-jwt-auth/pull/5#issuecomment-762718962
Hi, two open questions:
1. What about jsonpatch option instead of group alias? Sounds saner to me
2. Wat about multi key/jwt apps, shouldnt it be a map with the keyid as key (with a default)?
Otherwise looks good
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [geronimo-jwt-auth] rmannibucau commented on a change in pull request #5: alternative group claim
Posted by GitBox <gi...@apache.org>.
rmannibucau commented on a change in pull request #5:
URL: https://github.com/apache/geronimo-jwt-auth/pull/5#discussion_r560032892
##########
File path: src/main/java/org/apache/geronimo/microprofile/impl/jwtauth/servlet/JwtRequest.java
##########
@@ -132,6 +139,20 @@ public Principal getUserPrincipal() {
@Override
public boolean isUserInRole(final String role) {
+ if (tokenExtractor.get().containsClaim(groupsName)) {
Review comment:
Lets dont call get twice ;)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org