Skip to content

Commit

Permalink
AS7-4087: remove the static tags on the methods in SimpleSecurityManager
Browse files Browse the repository at this point in the history
  • Loading branch information
anilsaldhana authored and n1hility committed Mar 10, 2012
1 parent d5dc2d8 commit ef9ca41
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,11 @@ public interface SecurityMessages {
*/
@Message(id = 13323, value = "Invalid User")
SecurityException invalidUserException();

/**
* Create a {@link SecurityException} to indicate that the security management has not been injected
* @return {@link SecurityException}
*/
@Message(id = 13324, value = "Security Management not injected")
SecurityException securityManagementNotInjected();
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,22 @@
public class SimpleSecurityManager {
private ThreadLocalStack<SecurityContext> contexts = new ThreadLocalStack<SecurityContext>();

private static ISecurityManagement securityManagement = null;
private ISecurityManagement securityManagement = null;

private static PrivilegedAction<SecurityContext> securityContext() {
private PrivilegedAction<SecurityContext> securityContext() {
return new PrivilegedAction<SecurityContext>() {
public SecurityContext run() {
return SecurityContextAssociation.getSecurityContext();
}
};
}

private static SecurityContext establishSecurityContext(final String securityDomain) {
private SecurityContext establishSecurityContext(final String securityDomain) {
// Do not use SecurityFactory.establishSecurityContext, its static init is broken.
try {
final SecurityContext securityContext = SecurityContextFactory.createSecurityContext(securityDomain);
if(securityManagement == null)
throw SecurityMessages.MESSAGES.securityManagementNotInjected();
securityContext.setSecurityManagement(securityManagement);
SecurityContextAssociation.setSecurityContext(securityContext);
return securityContext;
Expand Down

0 comments on commit ef9ca41

Please sign in to comment.