• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_IAPP_ACCOUNT_H
17 #define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_IAPP_ACCOUNT_H
18 
19 #include "accountmgr_service_ipc_interface_code.h"
20 #include "app_account_common.h"
21 #include "app_account_info.h"
22 #include "app_account_subscribe_info.h"
23 #include "iremote_broker.h"
24 #include "iremote_object.h"
25 #include "want.h"
26 
27 namespace OHOS {
28 namespace AccountSA {
29 class IAppAccount : public IRemoteBroker {
30 public:
31     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.accountfwk.IAppAccount");
32 
33     virtual ErrCode AddAccount(const std::string &name, const std::string &extraInfo) = 0;
34     virtual ErrCode AddAccountImplicitly(const std::string &owner, const std::string &authType,
35         const AAFwk::Want &options, const sptr<IAppAccountAuthenticatorCallback> &callback) = 0;
36     virtual ErrCode CreateAccount(const std::string &name, const CreateAccountOptions &options) = 0;
37     virtual ErrCode CreateAccountImplicitly(const std::string &owner, const CreateAccountImplicitlyOptions &options,
38         const sptr<IAppAccountAuthenticatorCallback> &callback) = 0;
39     virtual ErrCode DeleteAccount(const std::string &name) = 0;
40 
41     virtual ErrCode GetAccountExtraInfo(const std::string &name, std::string &extraInfo) = 0;
42     virtual ErrCode SetAccountExtraInfo(const std::string &name, const std::string &extraInfo) = 0;
43 
44     virtual ErrCode EnableAppAccess(const std::string &name, const std::string &authorizedApp) = 0;
45     virtual ErrCode DisableAppAccess(const std::string &name, const std::string &authorizedApp) = 0;
46     virtual ErrCode SetAppAccess(const std::string &name, const std::string &authorizedApp, bool isAccessible) = 0;
47     virtual ErrCode CheckAppAccess(const std::string &name, const std::string &authorizedApp, bool &isAccessible) = 0;
48 
49     virtual ErrCode CheckAppAccountSyncEnable(const std::string &name, bool &syncEnable) = 0;
50     virtual ErrCode SetAppAccountSyncEnable(const std::string &name, const bool &syncEnable) = 0;
51 
52     virtual ErrCode GetAssociatedData(const std::string &name, const std::string &key, std::string &value) = 0;
53     virtual ErrCode SetAssociatedData(const std::string &name, const std::string &key, const std::string &value) = 0;
54 
55     virtual ErrCode GetAccountCredential(
56         const std::string &name, const std::string &credentialType, std::string &credential) = 0;
57     virtual ErrCode SetAccountCredential(
58         const std::string &name, const std::string &credentialType, const std::string &credential) = 0;
59     virtual ErrCode DeleteAccountCredential(const std::string &name, const std::string &credentialType) = 0;
60 
61     virtual ErrCode Authenticate(const std::string &name, const std::string &owner, const std::string &authType,
62         const AAFwk::Want &options, const sptr<IAppAccountAuthenticatorCallback> &callback) = 0;
63     virtual ErrCode GetOAuthToken(
64         const std::string &name, const std::string &owner, const std::string &authType, std::string &token) = 0;
65     virtual ErrCode GetAuthToken(
66         const std::string &name, const std::string &owner, const std::string &authType, std::string &token) = 0;
67     virtual ErrCode SetOAuthToken(
68         const std::string &name, const std::string &authType, const std::string &token) = 0;
69     virtual ErrCode DeleteOAuthToken(
70         const std::string &name, const std::string &owner, const std::string &authType, const std::string &token) = 0;
71     virtual ErrCode DeleteAuthToken(
72         const std::string &name, const std::string &owner, const std::string &authType, const std::string &token) = 0;
73     virtual ErrCode SetOAuthTokenVisibility(const std::string &name, const std::string &authType,
74         const std::string &bundleName, bool isVisible) = 0;
75     virtual ErrCode SetAuthTokenVisibility(const std::string &name, const std::string &authType,
76         const std::string &bundleName, bool isVisible) = 0;
77     virtual ErrCode CheckOAuthTokenVisibility(const std::string &name, const std::string &authType,
78         const std::string &bundleName, bool &isVisible) = 0;
79     virtual ErrCode CheckAuthTokenVisibility(const std::string &name, const std::string &authType,
80         const std::string &bundleName, bool &isVisible) = 0;
81     virtual ErrCode GetAuthenticatorInfo(const std::string &owner, AuthenticatorInfo &info) = 0;
82     virtual ErrCode GetAllOAuthTokens(const std::string &name, const std::string &owner,
83         std::vector<OAuthTokenInfo> &tokenInfos) = 0;
84     virtual ErrCode GetOAuthList(const std::string &name, const std::string &authType,
85         std::set<std::string> &oauthList) = 0;
86     virtual ErrCode GetAuthList(const std::string &name, const std::string &authType,
87         std::set<std::string> &oauthList) = 0;
88     virtual ErrCode GetAuthenticatorCallback(const std::string &sessionId, sptr<IRemoteObject> &callback) = 0;
89 
90     virtual ErrCode GetAllAccounts(const std::string &owner, std::vector<AppAccountInfo> &appAccounts) = 0;
91     virtual ErrCode GetAllAccessibleAccounts(std::vector<AppAccountInfo> &appAccounts) = 0;
92     virtual ErrCode QueryAllAccessibleAccounts(const std::string &owner, std::vector<AppAccountInfo> &appAccounts) = 0;
93     virtual ErrCode SelectAccountsByOptions(
94         const SelectAccountsOptions &options, const sptr<IAppAccountAuthenticatorCallback> &callback) = 0;
95     virtual ErrCode VerifyCredential(const std::string &name, const std::string &owner,
96         const VerifyCredentialOptions &options, const sptr<IAppAccountAuthenticatorCallback> &callback) = 0;
97     virtual ErrCode CheckAccountLabels(const std::string &name, const std::string &owner,
98         const std::vector<std::string> &labels, const sptr<IAppAccountAuthenticatorCallback> &callback) = 0;
99     virtual ErrCode SetAuthenticatorProperties(const std::string &owner, const SetPropertiesOptions &options,
100         const sptr<IAppAccountAuthenticatorCallback> &callback) = 0;
101     virtual ErrCode ExecuteRequest(const AccountCapabilityRequest &request,
102         const sptr<IAppAccountAuthorizationExtensionCallback> &callback) = 0;
103 
104     virtual ErrCode SubscribeAppAccount(
105         const AppAccountSubscribeInfo &subscribeInfo, const sptr<IRemoteObject> &eventListener) = 0;
106     virtual ErrCode UnsubscribeAppAccount(const sptr<IRemoteObject> &eventListener) = 0;
107 };
108 }  // namespace AccountSA
109 }  // namespace OHOS
110 
111 #endif  // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_IAPP_ACCOUNT_H
112