[49/50] [abbrv] tomee git commit: Fixed MP JWT Deploy.
Fixed MP JWT Deploy. Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/944b4190 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/944b4190 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/944b4190 Branch: refs/heads/tomee-7.1.x Commit: 944b41901870ed315c65577c7bd4031732228e97 Parents: 4b2d148 Author: Roberto Cortez Authored: Wed Jul 25 15:14:46 2018 +0100 Committer: Roberto Cortez Committed: Wed Jul 25 18:41:38 2018 +0100 -- .../org/apache/tomee/microprofile/jwt/MPJWTFilter.java| 10 +++--- tomee/tomee-microprofile-webapp/pom.xml | 3 --- 2 files changed, 7 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tomee/blob/944b4190/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/MPJWTFilter.java -- diff --git a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/MPJWTFilter.java b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/MPJWTFilter.java index a7b47d3..3990ad2 100644 --- a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/MPJWTFilter.java +++ b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/MPJWTFilter.java @@ -20,6 +20,7 @@ import org.apache.tomee.microprofile.jwt.config.JWTAuthContextInfo; import org.apache.tomee.microprofile.jwt.principal.JWTCallerPrincipalFactory; import org.eclipse.microprofile.jwt.JsonWebToken; +import javax.enterprise.inject.Instance; import javax.inject.Inject; import javax.security.auth.Subject; import javax.servlet.Filter; @@ -50,22 +51,25 @@ import java.util.stream.Collectors; public class MPJWTFilter implements Filter { @Inject -private JWTAuthContextInfo authContextInfo; +private Instance authContextInfo; @Override public void init(final FilterConfig filterConfig) throws ServletException { // nothing so far - +System.out.println("MPJWTFilter.init"); } @Override public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { +if (authContextInfo.isUnsatisfied()) { +return; +} final HttpServletRequest httpServletRequest = (HttpServletRequest) request; // now wrap the httpServletRequest and override the principal so CXF can propagate into the SecurityContext try { -chain.doFilter(new MPJWTServletRequestWrapper(httpServletRequest, authContextInfo), response); +chain.doFilter(new MPJWTServletRequestWrapper(httpServletRequest, authContextInfo.get()), response); } catch (final Exception e) { // this is an alternative to the @Provider bellow which requires registration on the fly http://git-wip-us.apache.org/repos/asf/tomee/blob/944b4190/tomee/tomee-microprofile-webapp/pom.xml -- diff --git a/tomee/tomee-microprofile-webapp/pom.xml b/tomee/tomee-microprofile-webapp/pom.xml index 54b915e..c9c2f0c 100644 --- a/tomee/tomee-microprofile-webapp/pom.xml +++ b/tomee/tomee-microprofile-webapp/pom.xml @@ -76,7 +76,6 @@ ${microprofile.config.impl.version} - -
[49/50] [abbrv] tomee git commit: Fixed MP JWT Deploy.
Fixed MP JWT Deploy. Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/944b4190 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/944b4190 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/944b4190 Branch: refs/heads/apache/tomee-7.1.x Commit: 944b41901870ed315c65577c7bd4031732228e97 Parents: 4b2d148 Author: Roberto Cortez Authored: Wed Jul 25 15:14:46 2018 +0100 Committer: Roberto Cortez Committed: Wed Jul 25 18:41:38 2018 +0100 -- .../org/apache/tomee/microprofile/jwt/MPJWTFilter.java| 10 +++--- tomee/tomee-microprofile-webapp/pom.xml | 3 --- 2 files changed, 7 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/tomee/blob/944b4190/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/MPJWTFilter.java -- diff --git a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/MPJWTFilter.java b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/MPJWTFilter.java index a7b47d3..3990ad2 100644 --- a/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/MPJWTFilter.java +++ b/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/MPJWTFilter.java @@ -20,6 +20,7 @@ import org.apache.tomee.microprofile.jwt.config.JWTAuthContextInfo; import org.apache.tomee.microprofile.jwt.principal.JWTCallerPrincipalFactory; import org.eclipse.microprofile.jwt.JsonWebToken; +import javax.enterprise.inject.Instance; import javax.inject.Inject; import javax.security.auth.Subject; import javax.servlet.Filter; @@ -50,22 +51,25 @@ import java.util.stream.Collectors; public class MPJWTFilter implements Filter { @Inject -private JWTAuthContextInfo authContextInfo; +private Instance authContextInfo; @Override public void init(final FilterConfig filterConfig) throws ServletException { // nothing so far - +System.out.println("MPJWTFilter.init"); } @Override public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { +if (authContextInfo.isUnsatisfied()) { +return; +} final HttpServletRequest httpServletRequest = (HttpServletRequest) request; // now wrap the httpServletRequest and override the principal so CXF can propagate into the SecurityContext try { -chain.doFilter(new MPJWTServletRequestWrapper(httpServletRequest, authContextInfo), response); +chain.doFilter(new MPJWTServletRequestWrapper(httpServletRequest, authContextInfo.get()), response); } catch (final Exception e) { // this is an alternative to the @Provider bellow which requires registration on the fly http://git-wip-us.apache.org/repos/asf/tomee/blob/944b4190/tomee/tomee-microprofile-webapp/pom.xml -- diff --git a/tomee/tomee-microprofile-webapp/pom.xml b/tomee/tomee-microprofile-webapp/pom.xml index 54b915e..c9c2f0c 100644 --- a/tomee/tomee-microprofile-webapp/pom.xml +++ b/tomee/tomee-microprofile-webapp/pom.xml @@ -76,7 +76,6 @@ ${microprofile.config.impl.version} - -