Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 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 | |
| 17 | package org.onosproject.security.store; |
| 18 | |
| 19 | import org.onosproject.core.ApplicationId; |
| 20 | import org.onosproject.security.Permission; |
| 21 | import org.onosproject.store.Store; |
| 22 | |
| 23 | import java.util.Set; |
| 24 | |
| 25 | /** |
| 26 | * Security-Mode ONOS distributed store service. |
| 27 | */ |
| 28 | public interface SecurityModeStore extends Store<SecurityModeEvent, SecurityModeStoreDelegate> { |
| 29 | |
| 30 | /** |
| 31 | * Updates the local bundle-application directories. |
| 32 | * @param appId application identifier |
| 33 | * @return true if successfully registered. |
| 34 | */ |
| 35 | boolean registerApplication(ApplicationId appId); |
| 36 | |
| 37 | /** |
| 38 | * Removes application info from the local bundle-application directories. |
| 39 | * @param appId application identifier |
| 40 | */ |
| 41 | void unregisterApplication(ApplicationId appId); |
| 42 | |
| 43 | /** |
| 44 | * Returns state of the specified application. |
| 45 | * @param appId application identifier |
| 46 | * @return Security-Mode State of application |
| 47 | */ |
| 48 | SecurityModeState getState(ApplicationId appId); |
| 49 | |
| 50 | /** |
| 51 | * Returns bundle locations of specified application. |
| 52 | * @param appId application identifier |
| 53 | * @return set of bundle location strings |
| 54 | */ |
| 55 | Set<String> getBundleLocations(ApplicationId appId); |
| 56 | |
| 57 | /** |
| 58 | * Returns application identifiers that are associated with given bundle location. |
| 59 | * @param location OSGi bundle location |
| 60 | * @return set of application identifiers |
| 61 | */ |
| 62 | Set<ApplicationId> getApplicationIds(String location); |
| 63 | |
| 64 | /** |
| 65 | * Returns a list of permissions that have been requested by given application. |
| 66 | * @param appId application identifier |
| 67 | * @return list of permissions |
| 68 | */ |
| 69 | Set<Permission> getRequestedPermissions(ApplicationId appId); |
| 70 | |
| 71 | /** |
| 72 | * Returns an array of permissions that have been granted to given application. |
| 73 | * @param appId application identifier |
| 74 | * @return array of permissionInfo |
| 75 | */ |
| 76 | Set<Permission> getGrantedPermissions(ApplicationId appId); |
| 77 | |
| 78 | /** |
| 79 | * Request permission that is required to run given application. |
| 80 | * @param appId application identifier |
| 81 | * @param permission permission |
| 82 | */ |
| 83 | void requestPermission(ApplicationId appId, Permission permission); |
| 84 | |
| 85 | /** |
| 86 | * Returns true if given application has been secured. |
| 87 | * @param appId application identifier |
| 88 | * @return true indicates secured |
| 89 | */ |
| 90 | boolean isSecured(ApplicationId appId); |
| 91 | |
| 92 | /** |
| 93 | * Notifies SM-ONOS that operator has reviewed the policy. |
| 94 | * @param appId application identifier |
| 95 | */ |
| 96 | void reviewPolicy(ApplicationId appId); |
| 97 | |
| 98 | /** |
| 99 | * Accept the current security policy of given application. |
| 100 | * @param appId application identifier |
| 101 | * @param permissionSet array of PermissionInfo |
| 102 | */ |
| 103 | void acceptPolicy(ApplicationId appId, Set<Permission> permissionSet); |
Changhoon Yoon | e71dfa4 | 2015-12-04 21:49:25 +0900 | [diff] [blame] | 104 | |
Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 105 | } |