jclouds/jclouds — pull request #919 by dralves (2012-10-28 03:16:18+00:00)
Title: First iteration on an oauth v2 impl

Keystone inspired impl of OAuth v2.

Right now implements the following:
- Json Web Tokens
- PKCS12 keystore pk loading
- RSAwithSHA256 signing

Notes:
- added a signature() method to Crypto to load signatures.
- right now scopes, claims etc are global properties. We probably want to make these Api/AsyncApi impl specific by annotating the REST methods/classes. I started to impl this but decided to post this version first, as it is working.

On a adding more finegrained authorization details:
Problem: Just specifying the HttpRequestFilter is not enough. Different REST methods/classes might require different tokens and the filter does not receive the method context so that we could parse additional annotations.

Idea: allow to specify request/response processors for a specific annotation

These processors would receive the current httprequest/response AND the Method so that additional annotations details could be used. The RestAnnotationProcessor would receive a map of RequestAnnotationProcessors and ReponseAnnotationProcessors each mapped to a specific annotation.

When processing any given method instead of having a bunch of ifs it would be possible to simply query the map for that specific annotation processor.

This would also have the advantage of allowing to simplify RestAnnotationProcessor and to make it easy for different modules to add their own annotations and annotation processors.

wdyt?