1821ed6489fa53d8fc057eb764e8081c04f821d7
[utils] / security / src / main / java / org / wamblee / security / authorization / AuthorizationException.java
1 /*
2  * Copyright 2005 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.wamblee.security.authorization;
17
18 /**
19  * Authorization exception to be thrown when a resouce may not be accessed.
20  *
21  * @author Erik Brakkee
22  */
23 public class AuthorizationException extends RuntimeException {
24     /**
25      * DOCUMENT ME!
26      */
27     private Object resource;
28
29     /**
30      * DOCUMENT ME!
31      */
32     private Operation operation;
33
34 /**
35      * Creates a new AuthorizationException object.
36      *
37      * @param aResource DOCUMENT ME!
38      * @param aOperation DOCUMENT ME!
39      */
40     public AuthorizationException(Object aResource, Operation aOperation) {
41         super("Operation '" + aOperation + "' not allowed on '" + aResource
42             + "'");
43         resource      = aResource;
44         operation     = aOperation;
45     }
46
47     /**
48      * DOCUMENT ME!
49      *
50      * @return DOCUMENT ME!
51      */
52     public Object getResource() {
53         return resource;
54     }
55
56     /**
57      * DOCUMENT ME!
58      *
59      * @return DOCUMENT ME!
60      */
61     public Operation getOperation() {
62         return operation;
63     }
64 }