You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2018/12/10 14:47:28 UTC
[25/38] tomee git commit: WIP
WIP
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/b12492dd
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/b12492dd
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/b12492dd
Branch: refs/heads/master
Commit: b12492dd1605dee93d8590afd7d784f4f3c69219
Parents: 8eb2ff3
Author: Jonathan Gallimore <jo...@jrg.me.uk>
Authored: Sat Nov 3 14:24:25 2018 +0000
Committer: Roberto Cortez <ra...@yahoo.com>
Committed: Fri Dec 7 18:13:05 2018 +0000
----------------------------------------------------------------------
.../org/apache/tomee/microprofile/jwt/MPJWTInitializer.java | 7 +++++++
.../apache/tomee/microprofile/jwt/cdi/MPJWTCDIExtension.java | 4 +++-
2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tomee/blob/b12492dd/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/MPJWTInitializer.java
----------------------------------------------------------------------
diff --git a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/MPJWTInitializer.java b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/MPJWTInitializer.java
index cede7dc..df92961 100644
--- a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/MPJWTInitializer.java
+++ b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/MPJWTInitializer.java
@@ -16,6 +16,8 @@
*/
package org.apache.tomee.microprofile.jwt;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.spi.SecurityService;
import org.eclipse.microprofile.auth.LoginConfig;
import javax.servlet.FilterRegistration;
@@ -52,6 +54,11 @@ public class MPJWTInitializer implements ServletContainerInitializer {
// See https://github.com/eclipse/microprofile-jwt-auth/issues/70 to clarify this point
}
+ final WebBeansContext webBeansContext = WebBeansContext.currentInstance();
+ final SecurityService securityService = webBeansContext.getSecurityService();
+
+ webBeansContext.registerService(SecurityService.class, new JWTWrappedSecurityService(securityService));
+
final FilterRegistration.Dynamic mpJwtFilter = ctx.addFilter("mp-jwt-filter", MPJWTFilter.class);
mpJwtFilter.setAsyncSupported(true);
mpJwtFilter.addMappingForUrlPatterns(null, false, "/*");
http://git-wip-us.apache.org/repos/asf/tomee/blob/b12492dd/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/cdi/MPJWTCDIExtension.java
----------------------------------------------------------------------
diff --git a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/cdi/MPJWTCDIExtension.java b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/cdi/MPJWTCDIExtension.java
index 6724bab..00fc24e 100644
--- a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/cdi/MPJWTCDIExtension.java
+++ b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/cdi/MPJWTCDIExtension.java
@@ -25,6 +25,8 @@ import org.eclipse.microprofile.jwt.Claim;
import org.eclipse.microprofile.jwt.JsonWebToken;
import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.RequestScoped;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Any;
@@ -107,7 +109,7 @@ public class MPJWTCDIExtension implements Extension {
.beanClass(JsonWebToken.class)
.types(JsonWebToken.class, Object.class)
.qualifiers(Default.Literal.INSTANCE, Any.Literal.INSTANCE)
- .scope(ApplicationScoped.class)
+ .scope(Dependent.class)
.createWith(ctx -> {
final Principal principal = getContextualReference(Principal.class, bm);
if (JsonWebToken.class.isInstance(principal)) {