1 22 package javax.security.auth.message; 23 24 30 public class MessagePolicy 31 { 32 protected TargetPolicy[] targetPolicies = null; 33 34 40 public MessagePolicy(TargetPolicy[] targetPolicies) 41 { 42 if( targetPolicies == null) 43 throw new IllegalArgumentException ("specified targetPolicies is null"); 44 45 this.targetPolicies = targetPolicies; 46 } 47 48 60 public TargetPolicy[]getTargetPolicies() 61 { 62 if(targetPolicies != null && targetPolicies.length == 0 ) 63 throw new IllegalStateException ("Target Policies should not be of zero length"); 64 return this.targetPolicies; 65 } 66 67 74 public static interface Target 75 { 76 84 public Object get(AuthParam authParam); 85 86 92 public void put(AuthParam authParam, Object data); 93 94 100 public void remove(AuthParam authParam); 101 } 102 103 public static class TargetPolicy 104 { 105 106 protected ProtectionPolicy protectionPolicy; 107 protected Target[] targets; 108 109 116 public TargetPolicy(Target[] targets, ProtectionPolicy protectionPolicy) 117 { 118 this.targets = targets; 119 this.protectionPolicy = protectionPolicy; 120 } 121 122 127 public ProtectionPolicy getProtectionPolicy() 128 { 129 return this.protectionPolicy; 130 } 131 132 140 public Target[] getTargets() 141 { 142 if(targets != null && targets.length == 0 ) 143 throw new IllegalStateException (" Targets cannot be of length zero"); 144 return this.targets; 145 } 146 } 147 148 153 public static interface ProtectionPolicy 154 { 155 158 public static final String AUTHENTICATE_RECIPIENT = "http://jboss.org/security/auth/container/auth_recipient"; 159 160 163 public static final String AUTHENTICATE_SOURCE = "http://jboss.org/security/auth/container/auth_source"; 164 165 168 public static final String AUTHENTICATE_SOURCE_CONTENT = "http://jboss.org/security/auth/container/auth_source_content"; 169 170 public String getID(); 171 } 172 173 } 174 | Popular Tags |