1 7 package org.jboss.security.plugins; 8 9 import java.io.Serializable ; 10 import java.util.HashSet ; 11 import java.util.Set ; 12 import java.security.Principal ; 13 import javax.security.auth.Subject ; 14 15 import org.jboss.security.AnybodyPrincipal; 16 import org.jboss.security.RealmMapping; 17 import org.jboss.security.SubjectSecurityManager; 18 19 20 31 public class NullSecurityManager 32 implements SubjectSecurityManager, RealmMapping, Serializable 33 { 34 static final long serialVersionUID = -5942994627247826747L; 35 private String securityDomain; 36 37 40 public NullSecurityManager(String securityDomain) 41 { 42 this.securityDomain = securityDomain; 43 } 44 45 48 public String getSecurityDomain() 49 { 50 return securityDomain; 51 } 52 55 public Subject getActiveSubject() 56 { 57 return null; 58 } 59 60 63 public boolean isValid(Principal principal, Object credential) 64 { 65 return true; 66 } 67 72 public boolean isValid(Principal principal, Object credential, 73 Subject activeSubject) 74 { 75 return true; 76 } 77 78 81 public Principal getPrincipal(Principal principal) 82 { 83 Principal result = principal; 84 return result; 85 } 86 87 93 public boolean doesUserHaveRole(Principal principal, Set roleNames) 94 { 95 boolean hasRole = true; 96 return hasRole; 97 } 98 99 102 public Set getUserRoles(Principal principal) 103 { 104 HashSet roles = new HashSet (); 105 roles.add(AnybodyPrincipal.ANYBODY_PRINCIPAL); 106 return roles; 107 } 108 109 114 private boolean authenticate(Principal principal, Object credential) 115 { 116 boolean authenticated = true; 117 return authenticated; 118 } 119 } 120 | Popular Tags |