-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes and rework for pac4j 5 (#239)
* added .fbExcludeFilterFile to .gitignore, changed pac4j to 5.3.1, changed jersey-pac4j back to 2.35, added tests to jersey228-pac4j, reworked dependencies-management * Refactoring for SessionStore providers and simplified usage by providing an implementation specific feature * We will need Java 11 for pac4j 5 Co-authored-by: Michael Kohlsche <[email protected]>
- Loading branch information
Showing
70 changed files
with
1,482 additions
and
558 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name: Java CI | ||
|
||
env: | ||
JDK_CURRENT: 8 | ||
JDK_CURRENT: 11 | ||
DISTRIBUTION: zulu | ||
|
||
on: | ||
|
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 |
---|---|---|
|
@@ -6,4 +6,5 @@ target/ | |
jax-rs-pac4j.iml | ||
.pmd | ||
.pmdruleset.xml | ||
*.iml | ||
*.iml | ||
.fbExcludeFilterFile |
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
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
30 changes: 30 additions & 0 deletions
30
core/src/main/java/org/pac4j/jax/rs/features/JaxRsSessionStoreProvider.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,30 @@ | ||
package org.pac4j.jax.rs.features; | ||
|
||
import javax.ws.rs.ext.ContextResolver; | ||
|
||
import org.pac4j.core.config.Config; | ||
import org.pac4j.core.context.session.SessionStore; | ||
|
||
/** | ||
* This class can be used to inject the pac4j {@link SessionStore} in the | ||
* JAX-RS runtime. | ||
* | ||
* This can be subclassed for container specific implementations. | ||
* | ||
* @author Michael Kohlsche | ||
* @since 5.0.0 | ||
*/ | ||
public class JaxRsSessionStoreProvider implements ContextResolver<SessionStore> { | ||
|
||
protected final Config config; | ||
|
||
public JaxRsSessionStoreProvider(Config config) { | ||
this.config = config; | ||
} | ||
|
||
@Override | ||
public SessionStore getContext(Class<?> type) { | ||
return config.getSessionStore(); | ||
} | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
core/src/main/java/org/pac4j/jax/rs/features/Pac4JFeature.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,46 @@ | ||
package org.pac4j.jax.rs.features; | ||
|
||
import javax.ws.rs.core.Feature; | ||
import javax.ws.rs.core.FeatureContext; | ||
|
||
import org.pac4j.core.config.Config; | ||
|
||
/** | ||
* This feature can be used to register the default set of necessary providers. | ||
* | ||
* This should be subclassed for container specific implementations and override | ||
* the necessary registration methods. | ||
* | ||
* @author Michael Kohlsche | ||
* @since 5.0.0 | ||
*/ | ||
public class Pac4JFeature implements Feature { | ||
|
||
protected final Config config; | ||
|
||
public Pac4JFeature(Config config) { | ||
this.config = config; | ||
} | ||
|
||
@Override | ||
public boolean configure(FeatureContext context) { | ||
return registerConfigProvider(context) && registerSessionStoreProvider(context) | ||
&& registerContextFactoryProvider(context); | ||
} | ||
|
||
protected boolean registerConfigProvider(FeatureContext context) { | ||
context.register(new JaxRsConfigProvider(config)); | ||
return true; | ||
} | ||
|
||
protected boolean registerContextFactoryProvider(FeatureContext context) { | ||
context.register(JaxRsContextFactoryProvider.class); | ||
return true; | ||
} | ||
|
||
protected boolean registerSessionStoreProvider(FeatureContext context) { | ||
context.register(new JaxRsSessionStoreProvider(config)); | ||
return true; | ||
} | ||
|
||
} |
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
Oops, something went wrong.