cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-5607] Minor update to the filter
Date Tue, 23 Jun 2015 14:26:53 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes f6fed10d4 -> 66eb71094


[CXF-5607] Minor update to the filter


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/66eb7109
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/66eb7109
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/66eb7109

Branch: refs/heads/3.0.x-fixes
Commit: 66eb710943ecdf72280022b3c862292c2839104d
Parents: f6fed10
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Tue Jun 23 15:25:22 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Tue Jun 23 15:26:34 2015 +0100

----------------------------------------------------------------------
 .../cxf/rs/security/oidc/rp/OidcClientCodeRequestFilter.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/66eb7109/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientCodeRequestFilter.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientCodeRequestFilter.java
b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientCodeRequestFilter.java
index 088f826..a509be9 100644
--- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientCodeRequestFilter.java
+++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/rp/OidcClientCodeRequestFilter.java
@@ -32,6 +32,9 @@ public class OidcClientCodeRequestFilter extends ClientCodeRequestFilter
{
     private boolean userInfoRequired = true; 
     @Override
     protected ClientTokenContext createTokenContext(ContainerRequestContext rc, ClientAccessToken
at) {
+        if (rc.getSecurityContext() instanceof OidcSecurityContext) {
+            return ((OidcSecurityContext)rc.getSecurityContext()).getOidcContext();
+        }
         OidcClientTokenContextImpl ctx = new OidcClientTokenContextImpl();
         if (at != null) {
             ctx.setIdToken(userInfoClient.getIdToken(at, getConsumer().getKey()));
@@ -52,7 +55,7 @@ public class OidcClientCodeRequestFilter extends ClientCodeRequestFilter
{
     @Override
     protected void checkSecurityContextStart(ContainerRequestContext rc) {
         SecurityContext sc = rc.getSecurityContext();
-        if (sc != null && !(sc instanceof OidcSecurityContext)) {
+        if (!(sc instanceof OidcSecurityContext) && sc.getUserPrincipal() != null)
{
             throw ExceptionUtils.toNotAuthorizedException(null, null);
         }
     }


Mime
View raw message