Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Bartel2013-07-23 07:20:55 +0000
committerJan Bartel2013-07-23 07:20:55 +0000
commitf19421112a90d993514ae20b09a6a95f18d57a2a (patch)
treeb22b1386e3e26bd091acfa69f981c2dff22a3100 /jetty-security
parent0aa2a5b6bbe1efb9cce8818ae0dfefd44b454475 (diff)
downloadorg.eclipse.jetty.project-f19421112a90d993514ae20b09a6a95f18d57a2a.tar.gz
org.eclipse.jetty.project-f19421112a90d993514ae20b09a6a95f18d57a2a.tar.xz
org.eclipse.jetty.project-f19421112a90d993514ae20b09a6a95f18d57a2a.zip
405535 implement Request.isUserInRole(role) check security-role-refs defaulting to security-role if no matching ref
Diffstat (limited to 'jetty-security')
-rw-r--r--jetty-security/src/main/java/org/eclipse/jetty/security/DefaultUserIdentity.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/DefaultUserIdentity.java b/jetty-security/src/main/java/org/eclipse/jetty/security/DefaultUserIdentity.java
index 28b0cb3a44..dd12b1d911 100644
--- a/jetty-security/src/main/java/org/eclipse/jetty/security/DefaultUserIdentity.java
+++ b/jetty-security/src/main/java/org/eclipse/jetty/security/DefaultUserIdentity.java
@@ -54,13 +54,19 @@ public class DefaultUserIdentity implements UserIdentity
}
public boolean isUserInRole(String role, Scope scope)
- {
+ {
if (scope!=null && scope.getRoleRefMap()!=null)
- role=scope.getRoleRefMap().get(role);
-
+ {
+ String mappedRole = scope.getRoleRefMap().get(role);
+ if (mappedRole != null)
+ role = mappedRole;
+ }
+
for (String r :_roles)
+ {
if (r.equals(role))
return true;
+ }
return false;
}

Back to the top