-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use standard/existing JWT claims #736
Comments
The PHP library allows setting both standard and custom claims (the code is already doing some of both), so changing the custom claims to standard claims is just a matter of changing one string to another. On the Java side, I have had good luck using the Java This means that reading the claims is as simple as |
In playing with this I was back inside Syn and I want to try converting it to a ServletFilter. This removes the dependencies on Tomcat. But also removes the availability of the Digester. So then I looked at replacing the syn-settings.xml with a YAML file. Just wondering if this seems like a bad idea from anyone?
|
@whikloj No tomcat dependency and yaml instead of xml? Works for me. |
@whikloj 👍 x 100 |
Ok, I'll move forward with this tentatively as I'm a novice at it. This will mean we will want to alter Crayfish to be able to handle the same YAML structure. When I have something in a PR form I'd appreciate all input and suggestions. |
There are a number of servlet filters defined in Trellis: https://github.com/trellis-ldp/trellis/tree/master/trellis-http/src/main/java/org/trellisldp/http (look for any class that ends in An example where I set the Principal from JWT claims is here: https://git.io/vNBmN (though that code is in the context of a dropwizard.io application) |
@acoburn being that this (I think) has to be a ServletFilter as we will use this to secure Fedora. What I have seen is people that read the JWT and if it authenticates basically pass along the chain a "fake" Principal with the parsed name and roles... I like your AgentAuthorizationFilter but can I use that as a standalone Filter to be used outside of a full JAX-RS application? Like I said, this is really new to me. |
@whikloj as I understand it, if you want your code to be independent of Tomcat, you will want to make use of JAX-RS interfaces (JAX-RS being the successor of the Servlet API). That is, while it's possible to just use the |
@acoburn, I'm not sure that is a good move. Whether or not we think of JAX-RS as in some sense a successor to the Servlet API, the Servlet API is alive and well, and it is what tomcat/Jetty/etc. implement-- not JAX-RS. This is what @whikloj ultimately would implement there. What brings a JAX-RS impl into the mix is a specific impl of Fedora, and writing to an impl is not what I would prefer to see. Staying agnostic with the Servlet API seems stronger to me. |
@acoburn @ajs6f So my reading seems to indicate that either the new JAX-RS methods (like ContainerRequestFilter) or the older ServletFilter are both just implementations of the Filter. If I go with a straight ServletFilter...the work should be transferable if we decide later to use the fancier JAX-RS methods? right? |
They are not the same, but the business logic that you write for either should be reusable. The real work is writing the filtering logic. The rest is packaging. If we decide to switch later, it's not a huge deal. If you expect to wire this filter in via |
@ajs6f thanks for chiming in here (I was hoping you would). I agree that the servlet-api |
Ok back to the actual subject of this ticket. So here is what I am thinking and let me know if this makes sense. Some of these might be dropped later, but for now.
For the id -> webid, we can consider either dropping it or altering it to be a full URI to the users account. |
Resolved via 9e42c33 |
Currently we use purely custom claims for JWT whose structure are drupal based: uid, roles, etc...
There are standard/existing claims out there we can utilize instead. First step is to see if any of the undelrying libraries we use in Java and PHP support them.
The text was updated successfully, but these errors were encountered: