cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: Another minor update to JAXRS SecurityContextImpl
Date Fri, 16 May 2014 09:06:57 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 0a54ffd4d -> c428da81f


Another minor update to JAXRS SecurityContextImpl


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

Branch: refs/heads/2.7.x-fixes
Commit: c428da81fe3d998ec734c235cfa2768933831949
Parents: 0a54ffd
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Fri May 16 10:05:32 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Fri May 16 10:06:35 2014 +0100

----------------------------------------------------------------------
 .../apache/cxf/jaxrs/impl/SecurityContextImpl.java   | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c428da81/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/SecurityContextImpl.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/SecurityContextImpl.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/SecurityContextImpl.java
index 9c7f24f..5127d7b 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/SecurityContextImpl.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/SecurityContextImpl.java
@@ -61,10 +61,7 @@ public class SecurityContextImpl implements SecurityContext {
     }
 
     public Principal getUserPrincipal() {
-        org.apache.cxf.security.SecurityContext sc = m.getContent(org.apache.cxf.security.SecurityContext.class);
-        if (sc == null) {
-            sc = m.get(org.apache.cxf.security.SecurityContext.class);
-        }
+        org.apache.cxf.security.SecurityContext sc = getInternalSecurityContext();
         return sc == null ? null : sc.getUserPrincipal();
     }
 
@@ -75,9 +72,15 @@ public class SecurityContextImpl implements SecurityContext {
     }
 
     public boolean isUserInRole(String role) {
-        org.apache.cxf.security.SecurityContext sc = 
-            m.get(org.apache.cxf.security.SecurityContext.class);
+        org.apache.cxf.security.SecurityContext sc = getInternalSecurityContext();
         return sc == null ? false : sc.isUserInRole(role);
     }
 
+    private org.apache.cxf.security.SecurityContext getInternalSecurityContext() {
+        org.apache.cxf.security.SecurityContext sc = m.getContent(org.apache.cxf.security.SecurityContext.class);
+        if (sc == null) {
+            sc = m.get(org.apache.cxf.security.SecurityContext.class);
+        }
+        return sc;
+    }
 }


Mime
View raw message