Bug 280367 Move jetty-specific Scope use into jetty specific UserIdentity implementation
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@399 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
5ad86fc8a8
commit
e68d8ba98f
|
@ -335,7 +335,7 @@ public class ConstraintSecurityHandler extends SecurityHandler implements Constr
|
|||
String[] roles = roleInfo.getRoles();
|
||||
for (String role : roles)
|
||||
{
|
||||
if (userIdentity.isUserInRole(role))
|
||||
if (userIdentity.isUserInRole(role, null))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -47,8 +47,11 @@ public class DefaultUserIdentity implements UserIdentity
|
|||
return _userPrincipal;
|
||||
}
|
||||
|
||||
public boolean isUserInRole(String role)
|
||||
public boolean isUserInRole(String role, Scope scope)
|
||||
{
|
||||
if (scope!=null && scope.getRoleRefMap()!=null)
|
||||
role=scope.getRoleRefMap().get(role);
|
||||
|
||||
for (String r :_roles)
|
||||
if (r.equals(role))
|
||||
return true;
|
||||
|
|
|
@ -46,10 +46,7 @@ public class UserAuthentication implements Authentication.User
|
|||
|
||||
public boolean isUserInRole(Scope scope, String role)
|
||||
{
|
||||
if (scope!=null && scope.getRoleRefMap()!=null)
|
||||
role=scope.getRoleRefMap().get(role);
|
||||
|
||||
return _userIdentity.isUserInRole(role);
|
||||
return _userIdentity.isUserInRole(role, scope);
|
||||
}
|
||||
|
||||
public void logout()
|
||||
|
|
|
@ -16,8 +16,6 @@ import java.security.Principal;
|
|||
import java.util.Map;
|
||||
|
||||
import javax.security.auth.Subject;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** User object that encapsulates user identity and operations such as run-as-role actions,
|
||||
|
@ -46,9 +44,10 @@ public interface UserIdentity
|
|||
* This call is used to satisfy authorization calls from
|
||||
* container code which will be using translated role names.
|
||||
* @param role A role name.
|
||||
* @param scope
|
||||
* @return True if the user can act in that role.
|
||||
*/
|
||||
boolean isUserInRole(String role);
|
||||
boolean isUserInRole(String role, Scope scope);
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -105,7 +104,7 @@ public interface UserIdentity
|
|||
return null;
|
||||
}
|
||||
|
||||
public boolean isUserInRole(String role)
|
||||
public boolean isUserInRole(String role, Scope scope)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue