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:25:47 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 9a3dd438d -> 816824971


[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/81682497
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/81682497
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/81682497

Branch: refs/heads/master
Commit: 8168249711b0d3379845435f7fc423aaf09ac233
Parents: 9a3dd43
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:25:22 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/81682497/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