001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.jetspeed.security;
018:
019: import org.apache.jetspeed.exception.JetspeedException;
020: import org.apache.jetspeed.i18n.KeyedMessage;
021:
022: /**
023: * <p>Exception throwns by members of the security service.</p>
024: *
025: * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
026: */
027: public class SecurityException extends JetspeedException {
028: /** The serial version uid. */
029: private static final long serialVersionUID = -8823877029853488430L;
030:
031: /** <p>Principal does not exist exception message.</p> */
032: public static final KeyedMessage PRINCIPAL_DOES_NOT_EXIST = new KeyedMessage(
033: "The principal {0} does not exist.");
034:
035: /** <p>Permission does not exist exception message.</p> */
036: public static final KeyedMessage PERMISSION_DOES_NOT_EXIST = new KeyedMessage(
037: "The permission {0} does not exist.");
038:
039: /** <p>User principal already exists exception message.</p> */
040: public static final KeyedMessage USER_ALREADY_EXISTS = new KeyedMessage(
041: "The user {0} already exists.");
042:
043: /** <p>User principal does not exist exception message.</p> */
044: public static final KeyedMessage USER_DOES_NOT_EXIST = new KeyedMessage(
045: "The user {0} does not exist.");
046:
047: /** <p>Role principal already exists exception message.</p> */
048: public static final KeyedMessage ROLE_ALREADY_EXISTS = new KeyedMessage(
049: "The role {0} already exists.");
050:
051: /** <p>Role principal does not exist exception message.</p> */
052: public static final KeyedMessage ROLE_DOES_NOT_EXIST = new KeyedMessage(
053: "The role {0} does not exist.");
054:
055: /** <p>Group principal already exists exception message.</p> */
056: public static final KeyedMessage GROUP_ALREADY_EXISTS = new KeyedMessage(
057: "The group {0} already exists.");
058:
059: /** <p>Group principal does not exist exception message.</p> */
060: public static final KeyedMessage GROUP_DOES_NOT_EXIST = new KeyedMessage(
061: "The group {0} does not exist.");
062:
063: /** <p>Invalid password exception message.</p> */
064: public static final KeyedMessage EMPTY_PARAMETER = new KeyedMessage(
065: "Invalid null or empty parameter {0}.");
066:
067: /** <p>Invalid password exception message.</p> */
068: public static final KeyedMessage INVALID_PASSWORD = new KeyedMessage(
069: "Invalid password.");
070:
071: /** <p>Invalid new password exception message.</p> */
072: public static final KeyedMessage INVALID_NEW_PASSWORD = new KeyedMessage(
073: "Invalid new password.");
074:
075: /** <p>Incorrect password exception message.</p> */
076: public static final KeyedMessage INCORRECT_PASSWORD = new KeyedMessage(
077: "Incorrect password.");
078:
079: /** <p>Password required exception message.</p> */
080: public static final KeyedMessage PASSWORD_REQUIRED = new KeyedMessage(
081: "Password required.");
082:
083: /** <p>Invalid authentication provider exception message.</p> */
084: public static final KeyedMessage INVALID_AUTHENTICATION_PROVIDER = new KeyedMessage(
085: "Invalid authentication provider {0}.");
086:
087: /** <p>Password already used exception message.</p> */
088: public static final KeyedMessage PASSWORD_ALREADY_USED = new KeyedMessage(
089: "Password already used.");
090:
091: /** <p>The anonymous user is protected exception message.</p> */
092: public static final KeyedMessage ANONYMOUS_USER_PROTECTED = new KeyedMessage(
093: "The user {0} is protected.");
094:
095: /** <p>The anonymous user is protected exception message.</p> */
096: public static final KeyedMessage UNEXPECTED = new KeyedMessage(
097: "Unexpected security error at {0} from {1}: {2}");
098:
099: /** <p>The uid is invalid.</p> */
100: public static final KeyedMessage INVALID_UID = new KeyedMessage(
101: "The uid cannot contain any regular expression meta-characters or be null or be empty.");
102:
103: /** <p>The dn is invalid.</p> */
104: public static final KeyedMessage INVALID_DN = new KeyedMessage(
105: "The dn cannot be null or empty.");
106:
107: /**
108: * <p>Default Constructor.</p>
109: */
110: public SecurityException() {
111: super ();
112: }
113:
114: public SecurityException(Throwable t) {
115: super (t);
116: }
117:
118: /**
119: * <p>Constructor with exception message.</p>
120: * @param message The exception message.
121: */
122: public SecurityException(KeyedMessage typedMessage) {
123: super (typedMessage);
124: }
125:
126: /**
127: * <p>Constructor with exception message and nested exception.</p>
128: * @param msg The exception message.
129: * @param nested Nested exception.
130: */
131: public SecurityException(KeyedMessage msg, Throwable nested) {
132: super(msg, nested);
133: }
134:
135: }
|