2 * ============LICENSE_START====================================================
4 * ===========================================================================
5 * Copyright (c) 2023 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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====================================================
22 package org.onap.ccsdk.apps.cadi;
24 import java.security.Principal;
25 import java.util.List;
30 * LUR: Local User Registry
32 * Concept by Robert Garskof, Implementation by Jonathan Gathman
34 * Where we can keep local copies of users and roles for faster Authorization when asked.
36 * Note: Author cannot resist the mental image of using a Fishing Lure to this LUR pattern
40 public interface Lur {
42 * Allow the Lur, which has correct Permission access, to create and hand back.
44 public Permission createPerm(String p);
47 * Fish for Principals in a Pond
49 * or more boringly, is the User identified within a named collection representing permission.
51 * @param principalName
54 public boolean fish(Principal bait, Permission ... pond);
57 * Fish all the Principals out a Pond
59 * For additional humor, pronounce the following with a Southern Drawl, "FishOil"
61 * or more boringly, load the List with Permissions found for Principal
63 * @param principalName
66 public void fishAll(Principal bait, List<Permission> permissions);
69 * Allow implementations to disconnect, or cleanup resources if unneeded
71 public void destroy();
74 * Does this LUR handle this pond exclusively? Important for EpiLUR to determine whether
75 * to try another (more expensive) LUR
79 public boolean handlesExclusively(Permission ... pond);
82 * Does the LUR support a particular kind of Principal
83 * This can be used to check name's domain, like above, or Principal type
85 public boolean handles(Principal principal);
88 * Clear: Clear any Caching, if exists
90 public void clear(Principal p, StringBuilder report);