1 /*
2 * Copyright (c) 2022 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 #include "account_iam_client.h"
17
18 #include "accesstoken_kit.h"
19 #include "account_error_no.h"
20 #include "account_iam_callback_service.h"
21 #include "account_log_wrapper.h"
22 #include "account_proxy.h"
23 #include "account_permission_manager.h"
24 #include "ipc_skeleton.h"
25 #include "ohos_account_kits_impl.h"
26 #include "os_account_manager.h"
27 #ifdef HAS_PIN_AUTH_PART
28 #include "pinauth_register.h"
29 #endif
30
31 namespace OHOS {
32 namespace AccountSA {
33 namespace {
34 const std::string PERMISSION_ACCESS_PIN_AUTH = "ohos.permission.ACCESS_PIN_AUTH";
35 const std::string PERMISSION_MANAGE_USER_IDM = "ohos.permission.MANAGE_USER_IDM";
36 const std::string PERMISSION_ACCESS_USER_AUTH_INTERNAL = "ohos.permission.ACCESS_USER_AUTH_INTERNAL";
37 }
38
GetInstance()39 AccountIAMClient &AccountIAMClient::GetInstance()
40 {
41 static AccountIAMClient *instance = new (std::nothrow) AccountIAMClient();
42 return *instance;
43 }
44
OpenSession(int32_t userId,std::vector<uint8_t> & challenge)45 int32_t AccountIAMClient::OpenSession(int32_t userId, std::vector<uint8_t> &challenge)
46 {
47 auto proxy = GetAccountIAMProxy();
48 if (proxy == nullptr) {
49 return ERR_ACCOUNT_COMMON_GET_PROXY;
50 }
51 return proxy->OpenSession(userId, challenge);
52 }
53
CloseSession(int32_t userId)54 int32_t AccountIAMClient::CloseSession(int32_t userId)
55 {
56 auto proxy = GetAccountIAMProxy();
57 if (proxy == nullptr) {
58 return ERR_ACCOUNT_COMMON_GET_PROXY;
59 }
60 return proxy->CloseSession(userId);
61 }
62
AddCredential(int32_t userId,const CredentialParameters & credInfo,const std::shared_ptr<IDMCallback> & callback)63 void AccountIAMClient::AddCredential(
64 int32_t userId, const CredentialParameters& credInfo, const std::shared_ptr<IDMCallback> &callback)
65 {
66 if (callback == nullptr) {
67 ACCOUNT_LOGE("the callback for adding credential is nullptr");
68 return;
69 }
70 Attributes emptyResult;
71 auto proxy = GetAccountIAMProxy();
72 if (proxy == nullptr) {
73 callback->OnResult(ERR_ACCOUNT_COMMON_GET_PROXY, emptyResult);
74 return;
75 }
76 if ((userId == 0) && (!GetCurrentUserId(userId))) {
77 ACCOUNT_LOGE("fail to add credential for invalid userId");
78 callback->OnResult(ERR_ACCOUNT_COMMON_INVALID_PARAMETER, emptyResult);
79 return;
80 }
81 if (credInfo.authType == AuthType::PIN) {
82 SetAuthSubType(userId, static_cast<int32_t>(credInfo.pinType.value_or(PinSubType::PIN_MAX)));
83 }
84 sptr<IIDMCallback> wrapper = new (std::nothrow) IDMCallbackService(userId, callback);
85 proxy->AddCredential(userId, credInfo, wrapper);
86 }
87
UpdateCredential(int32_t userId,const CredentialParameters & credInfo,const std::shared_ptr<IDMCallback> & callback)88 void AccountIAMClient::UpdateCredential(
89 int32_t userId, const CredentialParameters& credInfo, const std::shared_ptr<IDMCallback> &callback)
90 {
91 if (callback == nullptr) {
92 ACCOUNT_LOGE("the callback for updating credential is nullptr");
93 return;
94 }
95 Attributes emptyResult;
96 auto proxy = GetAccountIAMProxy();
97 if (proxy == nullptr) {
98 callback->OnResult(ERR_ACCOUNT_COMMON_GET_PROXY, emptyResult);
99 return;
100 }
101 if ((userId == 0) && (!GetCurrentUserId(userId))) {
102 ACCOUNT_LOGE("fail to update credential for invalid userId");
103 callback->OnResult(ERR_ACCOUNT_COMMON_INVALID_PARAMETER, emptyResult);
104 return;
105 }
106 if (credInfo.authType == AuthType::PIN) {
107 SetAuthSubType(userId, static_cast<int32_t>(credInfo.pinType.value_or(PinSubType::PIN_MAX)));
108 }
109 sptr<IIDMCallback> wrapper = new (std::nothrow) IDMCallbackService(userId, callback);
110 proxy->UpdateCredential(userId, credInfo, wrapper);
111 }
112
DelCred(int32_t userId,uint64_t credentialId,const std::vector<uint8_t> & authToken,const std::shared_ptr<IDMCallback> & callback)113 void AccountIAMClient::DelCred(int32_t userId, uint64_t credentialId, const std::vector<uint8_t> &authToken,
114 const std::shared_ptr<IDMCallback>& callback)
115 {
116 if (callback == nullptr) {
117 ACCOUNT_LOGE("the callback for deleting credential is nullptr");
118 return;
119 }
120 Attributes emptyResult;
121 auto proxy = GetAccountIAMProxy();
122 if (proxy == nullptr) {
123 callback->OnResult(ERR_ACCOUNT_COMMON_GET_PROXY, emptyResult);
124 return;
125 }
126 if ((userId == 0) && (!GetCurrentUserId(userId))) {
127 callback->OnResult(ERR_ACCOUNT_COMMON_INVALID_PARAMETER, emptyResult);
128 return;
129 }
130 sptr<IIDMCallback> wrapper = new (std::nothrow) IDMCallbackService(userId, callback);
131 proxy->DelCred(userId, credentialId, authToken, wrapper);
132 }
133
DelUser(int32_t userId,const std::vector<uint8_t> & authToken,const std::shared_ptr<IDMCallback> & callback)134 void AccountIAMClient::DelUser(
135 int32_t userId, const std::vector<uint8_t> &authToken, const std::shared_ptr<IDMCallback> &callback)
136 {
137 if (callback == nullptr) {
138 ACCOUNT_LOGE("the callback for deleting user is nullptr");
139 return;
140 }
141 Attributes emptyResult;
142 auto proxy = GetAccountIAMProxy();
143 if (proxy == nullptr) {
144 callback->OnResult(ERR_ACCOUNT_COMMON_GET_PROXY, emptyResult);
145 return;
146 }
147 if ((userId == 0) && (!GetCurrentUserId(userId))) {
148 callback->OnResult(ERR_ACCOUNT_COMMON_INVALID_PARAMETER, emptyResult);
149 return;
150 }
151 sptr<IIDMCallback> wrapper = new (std::nothrow) IDMCallbackService(userId, callback);
152 proxy->DelUser(userId, authToken, wrapper);
153 }
154
GetCredentialInfo(int32_t userId,AuthType authType,const std::shared_ptr<GetCredInfoCallback> & callback)155 int32_t AccountIAMClient::GetCredentialInfo(
156 int32_t userId, AuthType authType, const std::shared_ptr<GetCredInfoCallback> &callback)
157 {
158 auto proxy = GetAccountIAMProxy();
159 if (proxy == nullptr) {
160 return ERR_ACCOUNT_COMMON_GET_PROXY;
161 }
162 sptr<IGetCredInfoCallback> wrapper = new (std::nothrow) GetCredInfoCallbackService(callback);
163 ErrCode result = proxy->GetCredentialInfo(userId, authType, wrapper);
164 if ((result != ERR_OK) && (callback != nullptr)) {
165 std::vector<CredentialInfo> infoList;
166 callback->OnCredentialInfo(result, infoList);
167 }
168 return result;
169 }
170
Cancel(int32_t userId)171 int32_t AccountIAMClient::Cancel(int32_t userId)
172 {
173 auto proxy = GetAccountIAMProxy();
174 if (proxy == nullptr) {
175 return ERR_ACCOUNT_COMMON_GET_PROXY;
176 }
177 return proxy->Cancel(userId);
178 }
179
180 #ifdef HAS_PIN_AUTH_PART
StartDomainAuth(int32_t userId,const std::shared_ptr<IDMCallback> & callback)181 uint64_t AccountIAMClient::StartDomainAuth(int32_t userId, const std::shared_ptr<IDMCallback> &callback)
182 {
183 std::lock_guard<std::mutex> lock(domainMutex_);
184 Attributes emptyResult;
185 if (domainInputer_ == nullptr) {
186 ACCOUNT_LOGE("the registered inputer is not found or invalid");
187 callback->OnResult(ERR_ACCOUNT_IAM_KIT_INPUTER_NOT_REGISTERED, emptyResult);
188 return 0;
189 }
190 domainInputer_->OnGetData(IAMAuthType::DOMAIN, std::make_shared<DomainCredentialRecipient>(userId, callback));
191 return 0;
192 }
193 #endif
194
Auth(const std::vector<uint8_t> & challenge,AuthType authType,AuthTrustLevel authTrustLevel,const std::shared_ptr<IDMCallback> & callback)195 uint64_t AccountIAMClient::Auth(const std::vector<uint8_t> &challenge, AuthType authType,
196 AuthTrustLevel authTrustLevel, const std::shared_ptr<IDMCallback> &callback)
197 {
198 return AuthUser(0, challenge, authType, authTrustLevel, callback);
199 }
200
AuthUser(int32_t userId,const std::vector<uint8_t> & challenge,AuthType authType,AuthTrustLevel authTrustLevel,const std::shared_ptr<IDMCallback> & callback)201 uint64_t AccountIAMClient::AuthUser(
202 int32_t userId, const std::vector<uint8_t> &challenge, AuthType authType,
203 AuthTrustLevel authTrustLevel, const std::shared_ptr<IDMCallback> &callback)
204 {
205 uint64_t contextId = 0;
206 if (callback == nullptr) {
207 ACCOUNT_LOGE("callback is nullptr");
208 return contextId;
209 }
210 auto proxy = GetAccountIAMProxy();
211 if (proxy == nullptr) {
212 return contextId;
213 }
214 if ((userId == 0) && (!GetCurrentUserId(userId))) {
215 return contextId;
216 }
217 #ifdef HAS_PIN_AUTH_PART
218 if (static_cast<int32_t>(authType) == static_cast<int32_t>(IAMAuthType::DOMAIN)) {
219 return StartDomainAuth(userId, callback);
220 }
221 #endif
222 sptr<IIDMCallback> wrapper = new (std::nothrow) IDMCallbackService(userId, callback);
223 AuthParam authParam;
224 authParam.challenge = challenge;
225 authParam.authType = authType;
226 authParam.authTrustLevel = authTrustLevel;
227 ErrCode result = proxy->AuthUser(userId, authParam, wrapper, contextId);
228 if (result != ERR_OK) {
229 Attributes emptyResult;
230 callback->OnResult(result, emptyResult);
231 }
232 return contextId;
233 }
234
CancelAuth(uint64_t contextId)235 int32_t AccountIAMClient::CancelAuth(uint64_t contextId)
236 {
237 auto proxy = GetAccountIAMProxy();
238 if (proxy == nullptr) {
239 return ERR_ACCOUNT_COMMON_GET_PROXY;
240 }
241 return proxy->CancelAuth(contextId);
242 }
243
GetAvailableStatus(AuthType authType,AuthTrustLevel authTrustLevel,int32_t & status)244 int32_t AccountIAMClient::GetAvailableStatus(AuthType authType, AuthTrustLevel authTrustLevel, int32_t &status)
245 {
246 auto proxy = GetAccountIAMProxy();
247 if (proxy == nullptr) {
248 return ERR_ACCOUNT_COMMON_GET_PROXY;
249 }
250 if (authTrustLevel < UserIam::UserAuth::ATL1 || authTrustLevel > UserIam::UserAuth::ATL4) {
251 ACCOUNT_LOGE("authTrustLevel is not in correct range");
252 return ERR_ACCOUNT_COMMON_INVALID_PARAMETER;
253 }
254 if (authType < UserIam::UserAuth::ALL) {
255 ACCOUNT_LOGE("authType is not in correct range");
256 return ERR_ACCOUNT_COMMON_INVALID_PARAMETER;
257 }
258 return proxy->GetAvailableStatus(authType, authTrustLevel, status);
259 }
260
GetProperty(int32_t userId,const GetPropertyRequest & request,const std::shared_ptr<GetSetPropCallback> & callback)261 void AccountIAMClient::GetProperty(
262 int32_t userId, const GetPropertyRequest &request, const std::shared_ptr<GetSetPropCallback> &callback)
263 {
264 if (callback == nullptr) {
265 ACCOUNT_LOGE("the callback for getting property is nullptr");
266 return;
267 }
268 Attributes emptyResult;
269 auto proxy = GetAccountIAMProxy();
270 if (proxy == nullptr) {
271 callback->OnResult(ERR_ACCOUNT_COMMON_GET_PROXY, emptyResult);
272 return;
273 }
274 sptr<IGetSetPropCallback> wrapper = new (std::nothrow) GetSetPropCallbackService(callback);
275 proxy->GetProperty(userId, request, wrapper);
276 }
277
SetProperty(int32_t userId,const SetPropertyRequest & request,const std::shared_ptr<GetSetPropCallback> & callback)278 void AccountIAMClient::SetProperty(
279 int32_t userId, const SetPropertyRequest &request, const std::shared_ptr<GetSetPropCallback> &callback)
280 {
281 if (callback == nullptr) {
282 ACCOUNT_LOGE("the callback for setting property is nullptr");
283 return;
284 }
285 Attributes emptyResult;
286 auto proxy = GetAccountIAMProxy();
287 if (proxy == nullptr) {
288 callback->OnResult(ERR_ACCOUNT_COMMON_GET_PROXY, emptyResult);
289 return;
290 }
291 sptr<IGetSetPropCallback> wrapper = new (std::nothrow) GetSetPropCallbackService(callback);
292 proxy->SetProperty(userId, request, wrapper);
293 }
294
CheckSelfPermission(const std::string & permissionName)295 bool AccountIAMClient::CheckSelfPermission(const std::string &permissionName)
296 {
297 Security::AccessToken::AccessTokenID tokenId = IPCSkeleton::GetSelfTokenID();
298 ErrCode result = Security::AccessToken::AccessTokenKit::VerifyAccessToken(tokenId, permissionName);
299 return result == Security::AccessToken::TypePermissionState::PERMISSION_GRANTED;
300 }
301
302 #ifdef HAS_PIN_AUTH_PART
RegisterPINInputer(const std::shared_ptr<IInputer> & inputer)303 ErrCode AccountIAMClient::RegisterPINInputer(const std::shared_ptr<IInputer> &inputer)
304 {
305 std::lock_guard<std::mutex> lock(pinMutex_);
306 ErrCode result = AccountPermissionManager::CheckSystemApp(false);
307 if (result != ERR_OK) {
308 ACCOUNT_LOGE("is not system application, result = %{public}u.", result);
309 return result;
310 }
311 if (pinInputer_ != nullptr) {
312 ACCOUNT_LOGE("inputer is already registered");
313 return ERR_ACCOUNT_IAM_KIT_INPUTER_ALREADY_REGISTERED;
314 }
315 int32_t userId = 0;
316 if (!GetCurrentUserId(userId)) {
317 return ERR_ACCOUNT_IAM_KIT_GET_USERID_FAIL;
318 }
319 auto iamInputer = std::make_shared<IAMInputer>(userId, inputer);
320 if (iamInputer == nullptr) {
321 ACCOUNT_LOGE("failed to create IAMInputer");
322 return ERR_ACCOUNT_COMMON_INSUFFICIENT_MEMORY_ERROR;
323 }
324 if (UserIam::PinAuth::PinAuthRegister::GetInstance().RegisterInputer(iamInputer)) {
325 pinInputer_ = inputer;
326 return ERR_OK;
327 }
328 return ERR_ACCOUNT_COMMON_PERMISSION_DENIED;
329 }
330
RegisterDomainInputer(const std::shared_ptr<IInputer> & inputer)331 ErrCode AccountIAMClient::RegisterDomainInputer(const std::shared_ptr<IInputer> &inputer)
332 {
333 std::lock_guard<std::mutex> lock(domainMutex_);
334 if (domainInputer_ != nullptr) {
335 ACCOUNT_LOGE("inputer is already registered");
336 return ERR_ACCOUNT_IAM_KIT_INPUTER_ALREADY_REGISTERED;
337 }
338 domainInputer_ = inputer;
339 return ERR_OK;
340 }
341
RegisterInputer(int32_t authType,const std::shared_ptr<IInputer> & inputer)342 ErrCode AccountIAMClient::RegisterInputer(int32_t authType, const std::shared_ptr<IInputer> &inputer)
343 {
344 ErrCode result = AccountPermissionManager::CheckSystemApp(false);
345 if (result != ERR_OK) {
346 ACCOUNT_LOGE("is not system application, result = %{public}u.", result);
347 return result;
348 }
349 if ((!CheckSelfPermission(PERMISSION_ACCESS_USER_AUTH_INTERNAL)) &&
350 (!CheckSelfPermission(PERMISSION_MANAGE_USER_IDM))) {
351 ACCOUNT_LOGE("failed to check permission");
352 return ERR_ACCOUNT_COMMON_PERMISSION_DENIED;
353 }
354 if (inputer == nullptr) {
355 ACCOUNT_LOGE("inputer is nullptr");
356 return ERR_ACCOUNT_COMMON_INVALID_PARAMETER;
357 }
358 switch (authType) {
359 case IAMAuthType::DOMAIN:
360 return RegisterDomainInputer(inputer);
361 default:
362 return ERR_ACCOUNT_IAM_UNSUPPORTED_AUTH_TYPE;
363 }
364 }
365
UnregisterInputer(int32_t authType)366 ErrCode AccountIAMClient::UnregisterInputer(int32_t authType)
367 {
368 ErrCode result = AccountPermissionManager::CheckSystemApp(false);
369 if (result != ERR_OK) {
370 ACCOUNT_LOGE("is not system application, result = %{public}u.", result);
371 return result;
372 }
373 if ((!CheckSelfPermission(PERMISSION_ACCESS_USER_AUTH_INTERNAL)) &&
374 (!CheckSelfPermission(PERMISSION_MANAGE_USER_IDM))) {
375 ACCOUNT_LOGE("failed to check permission");
376 return ERR_ACCOUNT_COMMON_PERMISSION_DENIED;
377 }
378 switch (authType) {
379 case IAMAuthType::DOMAIN:
380 return UnregisterDomainInputer();
381 default:
382 return ERR_ACCOUNT_IAM_UNSUPPORTED_AUTH_TYPE;
383 }
384 return ERR_OK;
385 }
386
UnregisterPINInputer()387 ErrCode AccountIAMClient::UnregisterPINInputer()
388 {
389 ErrCode result = AccountPermissionManager::CheckSystemApp(false);
390 if (result != ERR_OK) {
391 ACCOUNT_LOGE("is not system application, result = %{public}u.", result);
392 return result;
393 }
394 if (!CheckSelfPermission(PERMISSION_ACCESS_PIN_AUTH)) {
395 ACCOUNT_LOGE("failed to check permission");
396 return ERR_ACCOUNT_COMMON_PERMISSION_DENIED;
397 }
398 UserIam::PinAuth::PinAuthRegister::GetInstance().UnRegisterInputer();
399 std::lock_guard<std::mutex> lock(pinMutex_);
400 pinInputer_ = nullptr;
401 return ERR_OK;
402 }
403
UnregisterDomainInputer()404 ErrCode AccountIAMClient::UnregisterDomainInputer()
405 {
406 std::lock_guard<std::mutex> lock(domainMutex_);
407 domainInputer_ = nullptr;
408 return ERR_OK;
409 }
410 #endif
411
GetAccountState(int32_t userId)412 IAMState AccountIAMClient::GetAccountState(int32_t userId)
413 {
414 auto proxy = GetAccountIAMProxy();
415 if (proxy == nullptr) {
416 return IDLE;
417 }
418 return proxy->GetAccountState(userId);
419 }
420
GetCredential(int32_t userId,CredentialItem & credItem)421 void AccountIAMClient::GetCredential(int32_t userId, CredentialItem &credItem)
422 {
423 std::lock_guard<std::mutex> lock(mutex_);
424 auto it = credentialMap_.find(userId);
425 if (it != credentialMap_.end()) {
426 credItem = it->second;
427 }
428 }
429
SetCredential(int32_t userId,const std::vector<uint8_t> & credential)430 void AccountIAMClient::SetCredential(int32_t userId, const std::vector<uint8_t> &credential)
431 {
432 std::lock_guard<std::mutex> lock(mutex_);
433 auto it = credentialMap_.find(userId);
434 if (it != credentialMap_.end()) {
435 it->second.oldCredential = it->second.credential;
436 it->second.credential = credential;
437 return;
438 }
439 credentialMap_[userId] = {
440 .credential = credential
441 };
442 }
443
ClearCredential(int32_t userId)444 void AccountIAMClient::ClearCredential(int32_t userId)
445 {
446 std::lock_guard<std::mutex> lock(mutex_);
447 credentialMap_.erase(userId);
448 }
449
SetAuthSubType(int32_t userId,int32_t authSubType)450 void AccountIAMClient::SetAuthSubType(int32_t userId, int32_t authSubType)
451 {
452 std::lock_guard<std::mutex> lock(mutex_);
453 auto it = credentialMap_.find(userId);
454 if (it != credentialMap_.end()) {
455 return;
456 }
457 credentialMap_[userId] = {
458 .type = authSubType
459 };
460 }
461
GetAuthSubType(int32_t userId)462 int32_t AccountIAMClient::GetAuthSubType(int32_t userId)
463 {
464 std::lock_guard<std::mutex> lock(mutex_);
465 auto it = credentialMap_.find(userId);
466 if (it != credentialMap_.end()) {
467 return it->second.type;
468 }
469 return 0;
470 }
471
GetCurrentUserId(int32_t & userId)472 bool AccountIAMClient::GetCurrentUserId(int32_t &userId)
473 {
474 std::vector<int32_t> userIds;
475 if ((OsAccountManager::QueryActiveOsAccountIds(userIds) != ERR_OK) || userIds.empty()) {
476 ACCOUNT_LOGE("fail to get activated os account ids");
477 return false;
478 }
479 userId = userIds[0];
480 return true;
481 }
482
ResetAccountIAMProxy(const wptr<IRemoteObject> & remote)483 void AccountIAMClient::ResetAccountIAMProxy(const wptr<IRemoteObject>& remote)
484 {
485 std::lock_guard<std::mutex> lock(mutex_);
486 if (proxy_ == nullptr) {
487 ACCOUNT_LOGE("proxy is nullptr");
488 return;
489 }
490 auto serviceRemote = proxy_->AsObject();
491 if ((serviceRemote != nullptr) && (serviceRemote == remote.promote())) {
492 serviceRemote->RemoveDeathRecipient(deathRecipient_);
493 proxy_ = nullptr;
494 }
495 }
496
OnRemoteDied(const wptr<IRemoteObject> & remote)497 void AccountIAMClient::AccountIAMDeathRecipient::OnRemoteDied(const wptr<IRemoteObject> &remote)
498 {
499 if (remote == nullptr) {
500 ACCOUNT_LOGE("remote is nullptr");
501 return;
502 }
503 AccountIAMClient::GetInstance().ResetAccountIAMProxy(remote);
504 }
505
GetAccountIAMProxy()506 sptr<IAccountIAM> AccountIAMClient::GetAccountIAMProxy()
507 {
508 std::lock_guard<std::mutex> lock(mutex_);
509 if (proxy_ != nullptr) {
510 return proxy_;
511 }
512 sptr<IRemoteObject> object = OhosAccountKitsImpl::GetInstance().GetAccountIAMService();
513 if (object == nullptr) {
514 ACCOUNT_LOGE("failed to get account iam service");
515 return nullptr;
516 }
517 deathRecipient_ = new (std::nothrow) AccountIAMDeathRecipient();
518 if (deathRecipient_ == nullptr) {
519 ACCOUNT_LOGE("failed to create account iam death recipient");
520 return nullptr;
521 }
522 if (!object->AddDeathRecipient(deathRecipient_)) {
523 ACCOUNT_LOGE("failed to add account iam death recipient");
524 deathRecipient_ = nullptr;
525 return nullptr;
526 }
527 proxy_ = iface_cast<IAccountIAM>(object);
528 if (proxy_ == nullptr) {
529 ACCOUNT_LOGE("failed to get account iam proxy");
530 }
531 return proxy_;
532 }
533 } // namespace AccountSA
534 } // namespace OHOS
535