1 22 23 package org.jboss.web.tomcat.security; 24 25 32 public class AllRolesMode 33 { 34 private String name; 35 38 public static final AllRolesMode STRICT_MODE = new AllRolesMode("strict"); 39 41 public static final AllRolesMode AUTH_ONLY_MODE = new AllRolesMode("authOnly"); 42 44 public static final AllRolesMode STRICT_AUTH_ONLY_MODE = new AllRolesMode("strictAuthOnly"); 45 46 static AllRolesMode toMode(String name) 47 { 48 AllRolesMode mode; 49 if( name.equalsIgnoreCase(STRICT_MODE.name) ) 50 mode = STRICT_MODE; 51 else if( name.equalsIgnoreCase(AUTH_ONLY_MODE.name) ) 52 mode = AUTH_ONLY_MODE; 53 else if( name.equalsIgnoreCase(STRICT_AUTH_ONLY_MODE.name) ) 54 mode = STRICT_AUTH_ONLY_MODE; 55 else 56 throw new IllegalStateException ("Unknown mode, must be one of: strict, authOnly, strictAuthOnly"); 57 return mode; 58 } 59 60 private AllRolesMode(String name) 61 { 62 this.name = name; 63 } 64 65 public boolean equals(Object o) 66 { 67 boolean equals = false; 68 if( o instanceof AllRolesMode ) 69 { 70 AllRolesMode mode = (AllRolesMode) o; 71 equals = name.equals(mode.name); 72 } 73 return equals; 74 } 75 public int hashCode() 76 { 77 return name.hashCode(); 78 } 79 public String toString() 80 { 81 return "AllRolesMode("+name+")"; 82 } 83 } 84 | Popular Tags |