blob: efad5f2eb18e8b007ade3d9c14114ec198baac65 [file] [log] [blame]
Changhoon Yoonb856b812015-08-10 03:47:19 +09001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Changhoon Yoonb856b812015-08-10 03:47:19 +09003 *
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
17package org.onosproject.security.store;
18
19import org.onosproject.core.ApplicationId;
20import org.onosproject.security.Permission;
21import org.onosproject.store.Store;
22
23import java.util.Set;
24
25/**
26 * Security-Mode ONOS distributed store service.
27 */
28public 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 Yoone71dfa42015-12-04 21:49:25 +0900104
Changhoon Yoonb856b812015-08-10 03:47:19 +0900105}