I have not tried this but imagine it should work:
Assuming you use CDI or something similar you could add a session scoped
bean to your custom realm which holds the organization and / or role of the
user. When the user picks his organization you save his choice in the helper
bean for use in your custom realm.
@Named
@Your-Scope-Of-Choice
public class CustomRealm extends AuthorizingRealm {
@Inject
private RoleHelperClass helper;
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection pc) {
if (helper.getRole().equals(...)) {...}
...
}
@Named
@SessionScoped
public class RoleHelperClass implements Serializable {
private Role role;
private String organization;
// getters and setters
}
--
View this message in context:
http://shiro-user.582556.n2.nabble.com/Different-Roles-based-on-Organization-tp7579375p7579380.html
Sent from the Shiro User mailing list archive at Nabble.com.