//Obviously this won't work if there are permissions. Setting the default subject if there are
//permissions breaks authentication.
boolean hasPermissions = securityHolder.getChecked().elements().hasMoreElements() ||
securityHolder.getExcluded().elements().hasMoreElements();
if (!hasPermissions && defaultSubject != null) {
Valve defaultSubjectValve = new DefaultSubjectValve(defaultSubject);
addValve(defaultSubjectValve);
} else {
//this will clear the thread of any read subject added by some other web app
addValve(new DefaultSubjectValve(null));
}
}
}
// Add User Defined Valves