View Javadoc

1   /* 
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.jetspeed.security;
18  
19  import org.apache.jetspeed.exception.JetspeedException;
20  import org.apache.jetspeed.i18n.KeyedMessage;
21  
22  /***
23   * <p>Exception throwns by members of the security service.</p>
24   *
25   * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
26   */
27  public class SecurityException extends JetspeedException
28  {
29      /*** The serial version uid. */
30      private static final long serialVersionUID = -8823877029853488430L;
31  
32      /*** <p>Principal does not exist exception message.</p> */
33      public static final KeyedMessage PRINCIPAL_DOES_NOT_EXIST = new KeyedMessage("The principal {0} does not exist.");
34  
35      /*** <p>Permission does not exist exception message.</p> */
36      public static final KeyedMessage PERMISSION_DOES_NOT_EXIST = new KeyedMessage("The permission {0} does not exist.");
37      
38      /*** <p>User principal already exists exception message.</p> */
39      public static final KeyedMessage USER_ALREADY_EXISTS = new KeyedMessage("The user {0} already exists.");
40  
41      /*** <p>User principal does not exist exception message.</p> */
42      public static final KeyedMessage USER_DOES_NOT_EXIST = new KeyedMessage("The user {0} does not exist.");
43  
44      /*** <p>Role principal already exists exception message.</p> */
45      public static final KeyedMessage ROLE_ALREADY_EXISTS = new KeyedMessage("The role {0} already exists.");
46  
47      /*** <p>Role principal does not exist exception message.</p> */
48      public static final KeyedMessage ROLE_DOES_NOT_EXIST = new KeyedMessage("The role {0} does not exist.");
49  
50      /*** <p>Group principal already exists exception message.</p> */
51      public static final KeyedMessage GROUP_ALREADY_EXISTS = new KeyedMessage("The group {0} already exists.");
52  
53      /*** <p>Group principal does not exist exception message.</p> */
54      public static final KeyedMessage GROUP_DOES_NOT_EXIST = new KeyedMessage("The group {0} does not exist.");
55  
56      /*** <p>Invalid password exception message.</p> */
57      public static final KeyedMessage EMPTY_PARAMETER = new KeyedMessage("Invalid null or empty parameter {0}.");
58  
59      /*** <p>Invalid password exception message.</p> */
60      public static final KeyedMessage INVALID_PASSWORD = new KeyedMessage("Invalid password.");
61  
62      /*** <p>Invalid new password exception message.</p> */
63      public static final KeyedMessage INVALID_NEW_PASSWORD = new KeyedMessage("Invalid new password.");
64  
65      /*** <p>Incorrect password exception message.</p> */
66      public static final KeyedMessage INCORRECT_PASSWORD = new KeyedMessage("Incorrect password.");
67  
68      /*** <p>Password required exception message.</p> */
69      public static final KeyedMessage PASSWORD_REQUIRED = new KeyedMessage("Password required.");
70      
71      /*** <p>Invalid authentication provider exception message.</p> */
72      public static final KeyedMessage INVALID_AUTHENTICATION_PROVIDER = new KeyedMessage("Invalid authentication provider {0}.");    
73  
74      /*** <p>Password already used exception message.</p> */
75      public static final KeyedMessage PASSWORD_ALREADY_USED = new KeyedMessage("Password already used.");
76  
77      /*** <p>The anonymous user is protected exception message.</p> */
78      public static final KeyedMessage ANONYMOUS_USER_PROTECTED = new KeyedMessage("The user {0} is protected.");
79  
80      /*** <p>The anonymous user is protected exception message.</p> */
81      public static final KeyedMessage UNEXPECTED = new KeyedMessage("Unexpected security error at {0} from {1}: {2}");
82      
83      /*** <p>The uid is invalid.</p> */
84      public static final KeyedMessage INVALID_UID = new KeyedMessage("The uid cannot contain any regular expression meta-characters or be null or be empty.");
85  
86      /*** <p>The dn is invalid.</p> */
87      public static final KeyedMessage INVALID_DN = new KeyedMessage("The dn cannot be null or empty.");
88      
89      /***
90       * <p>Default Constructor.</p>
91       */
92      public SecurityException()
93      {
94          super();
95      }
96  
97      public SecurityException(Throwable t)
98      {
99          super(t);
100     }
101     
102     /***
103      * <p>Constructor with exception message.</p>
104      * @param message The exception message.
105      */
106     public SecurityException(KeyedMessage typedMessage)
107     {
108         super(typedMessage);
109     }
110 
111     /***
112      * <p>Constructor with exception message and nested exception.</p>
113      * @param msg The exception message.
114      * @param nested Nested exception.
115      */
116     public SecurityException(KeyedMessage msg, Throwable nested)
117     {
118         super(msg, nested);
119     }
120 
121 }