-
Notifications
You must be signed in to change notification settings - Fork 20
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
Using provider instead of HttpServletRequest in ServletJaxRsContextFactoryProvider #42
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c1b8c80
Using provider instead of HttpServletRequest in ServletJaxRsContextFa…
5275b6d
Fixed review comments
43141ff
Fixed indentation
36c2246
Fixed review comments, added comments and updated README
2d46d88
updated the readme
6c64dae
updated the readme
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ These filters can be directly registered by hand, or instead, the following feat | |
5) Container/Implementation-specific Providers and Features extend the basic functionality provided by the generic ones | ||
|
||
- The `Pac4JValueFactoryProvider` enables injection of the security profile in resource method (for Apache Jersey <2.26, see [#30](https://github.com/pac4j/jax-rs-pac4j/issues/30)) | ||
- The `ServletJaxRsContextFactoryProvider` provides session handling (and thus indirect clients support) by replacing the generic `JaxRsContextFactoryProvider` (for Servlet-based JAX-RS implementations, e.g., Jersey on Netty or Grizzly Servlet, Resteasy on Undertow). This provider returns a RequestScoped context and so should be added as a class `ServletJaxRsContextFactoryProvider.class` instead of instance `new ServletJaxRsContextFactoryProvider()`. For RestEasy, you need to include `resteasy-cdi` support to your project. Refer to the tests in `resteasy-pac4j` module. | ||
- The `ServletJaxRsContextFactoryProvider` provides session handling (and thus indirect clients support) by replacing the generic `JaxRsContextFactoryProvider` (for Servlet-based JAX-RS implementations, e.g., Jersey on Netty or Grizzly Servlet, Resteasy on Undertow). | ||
- The `GrizzlyJaxRsContextFactoryProvider` provides session handling (and thus indirect clients support) by replacing the generic `JaxRsContextFactoryProvider` (for Grizzly2 without Servlet support). | ||
|
||
--- | ||
|
@@ -50,7 +50,7 @@ You need to add a dependency on: | |
|
||
- jax-rs-pac4j | ||
1. for Jersey (<2.26) : the `jersey-pac4j` library (<em>groupId</em>: **org.pac4j**, *version*: **3.0.0**) | ||
2. for Resteasy : the `resteasy-pac4j` library (<em>groupId</em>: **org.pac4j**, *version*: **3.0.0**) | ||
2. for Resteasy : the `resteasy-pac4j` library (<em>groupId</em>: **org.pac4j**, *version*: **3.0.0**) and resteasy-cdi for CDI support | ||
- the appropriate `pac4j` [submodules](http://www.pac4j.org/docs/clients.html) (<em>groupId</em>: **org.pac4j**, *version*: **2.1.0**): `pac4j-oauth` for OAuth support (Facebook, Twitter...), `pac4j-cas` for CAS support, `pac4j-ldap` for LDAP authentication, etc. | ||
|
||
All released artifacts are available in the [Maven central repository](http://search.maven.org/#search%7Cga%7C1%7Cpac4j). | ||
|
@@ -122,7 +122,7 @@ resourceConfig | |
For a Jersey-based and Servlet-based (e.g., Jetty or Grizzly Servlet) environment with session management, annotation support and method parameters injection: | ||
```java | ||
resourceConfig | ||
.register(new ServletJaxRsContextFactoryProvider(config)) | ||
.register(ServletJaxRsContextFactoryProvider.class) | ||
.register(new Pac4JSecurityFeature(config)) | ||
.register(new Pac4JValueFactoryProvider.Binder()); | ||
``` | ||
|
@@ -144,13 +144,20 @@ For a Resteasy-based and Servlet-based (e.g., Undertow) environment with session | |
public Set<Object> getSingletons() { | ||
Config config = getConfig(); | ||
Set<Object> singletons = new HashSet<>(); | ||
singletons.add(new ServletJaxRsContextFactoryProvider(config)); | ||
singletons.add(new Pac4JSecurityFeature(config)); | ||
singletons.add(new Pac4JProfileInjectorFactory()); | ||
return singletons; | ||
} | ||
|
||
@Override | ||
public Set<Class<?>> getClasses() { | ||
Set<Class<?>> classes = new HashSet<>(); | ||
classes.add(ServletJaxRsContextFactoryProvider.class); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return classes; | ||
} | ||
} | ||
``` | ||
For RestEasy, you need to include `resteasy-cdi` support to your project to ensure that dependencies are injected at runtime. Refer to the tests in `resteasy-pac4j` module. | ||
|
||
Note that a default value for the `clients` parameter of the `@Pac4JSecurity` | ||
annotation can be passed to the constructor of `Pac4JSecurityFeature`. | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add backquotes around
resteasy-cdi
please