1e44726a3a6417deed99bc24a9f716bc9e086cc2
[aaf/authz.git] / cadi / core / src / main / java / org / onap / aaf / cadi / lur / NullLur.java
1 /**
2  * ============LICENSE_START====================================================
3  * org.onap.aaf
4  * ===========================================================================
5  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6  * ===========================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END====================================================
19  *
20  */
21
22 package org.onap.aaf.cadi.lur;
23
24 import java.security.Principal;
25 import java.util.List;
26
27 import org.onap.aaf.cadi.Lur;
28 import org.onap.aaf.cadi.Permission;
29
30 public class NullLur implements Lur {
31         private static final Permission NULL = new Permission() {
32                 @Override
33                 public String permType() {
34                         return "";
35                 }
36
37                 @Override
38                 public String getKey() {
39                         return "";
40                 }
41
42                 @Override
43                 public boolean match(Permission p) {
44                         return false;
45                 }};
46
47         public boolean fish(Principal bait, Permission pond) {
48                 // Well, for Jenkins, this is ok... It finds out it can't do J2EE Security, and then looks at it's own
49 //              System.err.println("CADI's LUR has not been configured, but is still being called.  Access is being denied");
50                 return false;
51         }
52
53         public void fishAll(Principal bait,     List<Permission> permissions) {
54         }
55
56         public void destroy() {
57         }
58
59         public boolean handlesExclusively(Permission pond) {
60                 return false;
61         }
62
63         public boolean handles(Principal p) {
64                 return false;
65         }
66
67         /* (non-Javadoc)
68          * @see org.onap.aaf.cadi.Lur#createPerm(java.lang.String)
69          */
70         @Override
71         public Permission createPerm(String p) {
72                 return NULL;
73         }
74
75         /* (non-Javadoc)
76          * @see org.onap.aaf.cadi.Lur#clear(java.security.Principal, java.lang.StringBuilder)
77          */
78         @Override
79         public void clear(Principal p, StringBuilder report) {
80                 report.append(NullLur.class.getSimpleName());
81                 report.append('\n');
82         }
83         
84         public String toString() {
85                 return NullLur.class.getSimpleName() + '\n';
86         }
87 }