mirror of
https://gitee.com/openharmony/account_os_account
synced 2024-11-30 13:40:31 +00:00
extension名字整改
Signed-off-by: 123 <834689456@qq.com> Change-Id: I675b1e061aafff92623b514df9100aeed77a96a3
This commit is contained in:
parent
1e95d04c47
commit
0ff1397394
@ -47,6 +47,7 @@
|
||||
"hitrace_native",
|
||||
"hiviewdfx_hilog_native",
|
||||
"init",
|
||||
"i18n",
|
||||
"ipc",
|
||||
"napi",
|
||||
"pin_auth",
|
||||
@ -81,8 +82,8 @@
|
||||
"service_group": [
|
||||
"//base/account/os_account/services:services_target",
|
||||
"//base/account/os_account/services/accountmgr/src/appaccount:app_account_service_core",
|
||||
"//base/account/os_account/frameworks/appaccount/extension:authentication_extension",
|
||||
"//base/account/os_account/frameworks/appaccount/extension:authentication_extension_module",
|
||||
"//base/account/os_account/frameworks/appaccount/extension:authorization_extension",
|
||||
"//base/account/os_account/frameworks/appaccount/extension:authorization_extension_module",
|
||||
"//base/account/os_account/interfaces/kits/napi/appaccount/authorization_extension_ability:authorizationextensionability_napi"
|
||||
]
|
||||
},
|
||||
|
@ -14,7 +14,7 @@
|
||||
import("//build/ohos.gni")
|
||||
import("../../../os_account.gni")
|
||||
|
||||
config("authentication_extension_config") {
|
||||
config("authorization_extension_config") {
|
||||
visibility = [ ":*" ]
|
||||
|
||||
cflags = []
|
||||
@ -27,12 +27,12 @@ config("authentication_extension_config") {
|
||||
]
|
||||
}
|
||||
|
||||
config("authentication_extension_public_config") {
|
||||
config("authorization_extension_public_config") {
|
||||
visibility = [ ":*" ]
|
||||
include_dirs = [ "include" ]
|
||||
}
|
||||
|
||||
ohos_shared_library("authentication_extension") {
|
||||
ohos_shared_library("authorization_extension") {
|
||||
include_dirs = [
|
||||
"${os_account_path}/interfaces/innerkits/appaccount/native/include",
|
||||
"${os_account_path}/frameworks/appaccount/native/include",
|
||||
@ -40,14 +40,14 @@ ohos_shared_library("authentication_extension") {
|
||||
"${app_account_kits_path}/include",
|
||||
]
|
||||
sources = [
|
||||
"${app_account_kits_path}/src/napi_app_account_authentication_extension.cpp",
|
||||
"src/authentication_extension.cpp",
|
||||
"${app_account_kits_path}/src/napi_app_account_authorization_extension.cpp",
|
||||
"src/authorization_extension.cpp",
|
||||
]
|
||||
configs = [
|
||||
":authentication_extension_config",
|
||||
":authorization_extension_config",
|
||||
"${account_coverage_config_path}:coverage_flags",
|
||||
]
|
||||
public_configs = [ ":authentication_extension_public_config" ]
|
||||
public_configs = [ ":authorization_extension_public_config" ]
|
||||
|
||||
deps = [
|
||||
"${account_napi_common_path}:account_napi_common",
|
||||
@ -74,19 +74,19 @@ ohos_shared_library("authentication_extension") {
|
||||
part_name = "os_account"
|
||||
}
|
||||
|
||||
ohos_shared_library("authentication_extension_module") {
|
||||
ohos_shared_library("authorization_extension_module") {
|
||||
include_dirs = [ "include" ]
|
||||
|
||||
sources = [ "src/authentication_extension_module_loader.cpp" ]
|
||||
sources = [ "src/authorization_extension_module_loader.cpp" ]
|
||||
|
||||
configs = [
|
||||
":authentication_extension_config",
|
||||
":authorization_extension_config",
|
||||
"${account_coverage_config_path}:coverage_flags",
|
||||
]
|
||||
public_configs = [ ":authentication_extension_public_config" ]
|
||||
public_configs = [ ":authorization_extension_public_config" ]
|
||||
|
||||
deps = [
|
||||
":authentication_extension",
|
||||
":authorization_extension",
|
||||
"${common_path}:libaccount_common",
|
||||
]
|
||||
|
||||
|
@ -13,10 +13,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_OHOS_AUTHENTICATION_EXTENSION_H
|
||||
#define OS_ACCOUNT_OHOS_AUTHENTICATION_EXTENSION_H
|
||||
#ifndef OS_ACCOUNT_OHOS_AUTHORIZATION_EXTENSION_H
|
||||
#define OS_ACCOUNT_OHOS_AUTHORIZATION_EXTENSION_H
|
||||
|
||||
#include "authentication_extension_context.h"
|
||||
#include "authorization_extension_context.h"
|
||||
#include "extension_base.h"
|
||||
#include "runtime.h"
|
||||
|
||||
@ -25,10 +25,10 @@ namespace AbilityRuntime {
|
||||
/**
|
||||
* @brief Basic authentication components.
|
||||
*/
|
||||
class AuthenticationExtension : public ExtensionBase<AuthenticationExtensionContext> {
|
||||
class AuthorizationExtension : public ExtensionBase<AuthorizationExtensionContext> {
|
||||
public:
|
||||
AuthenticationExtension() = default;
|
||||
virtual ~AuthenticationExtension() = default;
|
||||
AuthorizationExtension() = default;
|
||||
virtual ~AuthorizationExtension() = default;
|
||||
|
||||
/**
|
||||
* @brief Create and init context.
|
||||
@ -39,7 +39,7 @@ public:
|
||||
* @param token the remote token.
|
||||
* @return The created context.
|
||||
*/
|
||||
virtual std::shared_ptr<AuthenticationExtensionContext> CreateAndInitContext(
|
||||
virtual std::shared_ptr<AuthorizationExtensionContext> CreateAndInitContext(
|
||||
const std::shared_ptr<AbilityLocalRecord> &record, const std::shared_ptr<OHOSApplication> &application,
|
||||
std::shared_ptr<AbilityHandler> &handler, const sptr<IRemoteObject> &token) override;
|
||||
|
||||
@ -61,7 +61,7 @@ public:
|
||||
* @param runtime The runtime.
|
||||
* @return The InputMethodExtension instance.
|
||||
*/
|
||||
static AuthenticationExtension *Create(const std::unique_ptr<Runtime> &runtime);
|
||||
static AuthorizationExtension *Create(const std::unique_ptr<Runtime> &runtime);
|
||||
};
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_ABILITY_RUNTIME_AUTHENTICATION_EXTENSION_CONTEXT_H
|
||||
#define OHOS_ABILITY_RUNTIME_AUTHENTICATION_EXTENSION_CONTEXT_H
|
||||
#ifndef OHOS_ABILITY_RUNTIME_AUTHORIZATION_EXTENSION_CONTEXT_H
|
||||
#define OHOS_ABILITY_RUNTIME_AUTHORIZATION_EXTENSION_CONTEXT_H
|
||||
|
||||
#include "ability_connect_callback.h"
|
||||
#include "connection_manager.h"
|
||||
@ -29,14 +29,14 @@ namespace AbilityRuntime {
|
||||
* @brief context supply for service
|
||||
*
|
||||
*/
|
||||
class AuthenticationExtensionContext : public ExtensionContext {
|
||||
class AuthorizationExtensionContext : public ExtensionContext {
|
||||
public:
|
||||
AuthenticationExtensionContext() = default;
|
||||
virtual ~AuthenticationExtensionContext() = default;
|
||||
AuthorizationExtensionContext() = default;
|
||||
virtual ~AuthorizationExtensionContext() = default;
|
||||
|
||||
ErrCode StartModalDialogForResult(const AAFwk::Want &want) const;
|
||||
|
||||
using SelfType = AuthenticationExtensionContext;
|
||||
using SelfType = AuthorizationExtensionContext;
|
||||
static const size_t CONTEXT_TYPE_ID;
|
||||
|
||||
private:
|
||||
@ -51,4 +51,4 @@ private:
|
||||
};
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_ABILITY_RUNTIME_AUTHENTICATION_EXTENSION_CONTEXT_H
|
||||
#endif // OHOS_ABILITY_RUNTIME_AUTHORIZATION_EXTENSION_CONTEXT_H
|
@ -13,15 +13,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_ABILITY_RUNTIME_AUTHENTICATION_EXTENSION_MODULE_LOADER_H
|
||||
#define OHOS_ABILITY_RUNTIME_AUTHENTICATION_EXTENSION_MODULE_LOADER_H
|
||||
#ifndef OHOS_ABILITY_RUNTIME_AUTHORIZATION_EXTENSION_MODULE_LOADER_H
|
||||
#define OHOS_ABILITY_RUNTIME_AUTHORIZATION_EXTENSION_MODULE_LOADER_H
|
||||
|
||||
#include "extension_module_loader.h"
|
||||
|
||||
namespace OHOS::AbilityRuntime {
|
||||
class AuthenticationExtensionModuleLoader : public ExtensionModuleLoader,
|
||||
public Singleton<AuthenticationExtensionModuleLoader> {
|
||||
DECLARE_SINGLETON(AuthenticationExtensionModuleLoader);
|
||||
class AuthorizationExtensionModuleLoader : public ExtensionModuleLoader,
|
||||
public Singleton<AuthorizationExtensionModuleLoader> {
|
||||
DECLARE_SINGLETON(AuthorizationExtensionModuleLoader);
|
||||
|
||||
public:
|
||||
/**
|
||||
@ -35,4 +35,4 @@ public:
|
||||
virtual std::map<std::string, std::string> GetParams() override;
|
||||
};
|
||||
} // namespace OHOS::AbilityRuntime
|
||||
#endif // OHOS_ABILITY_RUNTIME_AUTHENTICATION_EXTENSION_MODULE_LOADER_H
|
||||
#endif // OHOS_ABILITY_RUNTIME_AUTHORIZATION_EXTENSION_MODULE_LOADER_H
|
@ -13,13 +13,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "authentication_extension.h"
|
||||
#include "authorization_extension.h"
|
||||
|
||||
#include "ability_loader.h"
|
||||
#include "account_log_wrapper.h"
|
||||
#include "authentication_extension_context.h"
|
||||
#include "authorization_extension_context.h"
|
||||
#include "connection_manager.h"
|
||||
#include "napi_app_account_authentication_extension.h"
|
||||
#include "napi_app_account_authorization_extension.h"
|
||||
#include "runtime.h"
|
||||
|
||||
using namespace OHOS::AccountSA;
|
||||
@ -27,32 +27,32 @@ using namespace OHOS::AccountSA;
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
using namespace OHOS::AppExecFwk;
|
||||
AuthenticationExtension *AuthenticationExtension::Create(const std::unique_ptr<Runtime> &runtime)
|
||||
AuthorizationExtension *AuthorizationExtension::Create(const std::unique_ptr<Runtime> &runtime)
|
||||
{
|
||||
if (runtime == nullptr) {
|
||||
return new AuthenticationExtension();
|
||||
return new AuthorizationExtension();
|
||||
}
|
||||
switch (runtime->GetLanguage()) {
|
||||
case Runtime::Language::JS:
|
||||
return AccountJsKit::JsAuthenticationExtension::Create(runtime);
|
||||
return AccountJsKit::JsAuthorizationExtension::Create(runtime);
|
||||
default:
|
||||
return new AuthenticationExtension();
|
||||
return new AuthorizationExtension();
|
||||
}
|
||||
}
|
||||
|
||||
void AuthenticationExtension::Init(const std::shared_ptr<AbilityLocalRecord> &record,
|
||||
void AuthorizationExtension::Init(const std::shared_ptr<AbilityLocalRecord> &record,
|
||||
const std::shared_ptr<OHOSApplication> &application, std::shared_ptr<AbilityHandler> &handler,
|
||||
const sptr<IRemoteObject> &token)
|
||||
{
|
||||
ExtensionBase<AuthenticationExtensionContext>::Init(record, application, handler, token);
|
||||
ExtensionBase<AuthorizationExtensionContext>::Init(record, application, handler, token);
|
||||
}
|
||||
|
||||
std::shared_ptr<AuthenticationExtensionContext> AuthenticationExtension::CreateAndInitContext(
|
||||
std::shared_ptr<AuthorizationExtensionContext> AuthorizationExtension::CreateAndInitContext(
|
||||
const std::shared_ptr<AbilityLocalRecord> &record, const std::shared_ptr<OHOSApplication> &application,
|
||||
std::shared_ptr<AbilityHandler> &handler, const sptr<IRemoteObject> &token)
|
||||
{
|
||||
std::shared_ptr<AuthenticationExtensionContext> context =
|
||||
ExtensionBase<AuthenticationExtensionContext>::CreateAndInitContext(record, application, handler, token);
|
||||
std::shared_ptr<AuthorizationExtensionContext> context =
|
||||
ExtensionBase<AuthorizationExtensionContext>::CreateAndInitContext(record, application, handler, token);
|
||||
return context;
|
||||
}
|
||||
} // namespace AbilityRuntime
|
@ -22,11 +22,11 @@
|
||||
using namespace OHOS::AccountSA;
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
const size_t AuthenticationExtensionContext::CONTEXT_TYPE_ID(
|
||||
std::hash<const char *>{}("AuthenticationExtensionContext"));
|
||||
int AuthenticationExtensionContext::ILLEGAL_REQUEST_CODE(-1);
|
||||
const size_t AuthorizationExtensionContext::CONTEXT_TYPE_ID(
|
||||
std::hash<const char *>{}("AuthorizationExtensionContext"));
|
||||
int AuthorizationExtensionContext::ILLEGAL_REQUEST_CODE(-1);
|
||||
|
||||
ErrCode AuthenticationExtensionContext::StartModalDialogForResult(const AAFwk::Want &want) const
|
||||
ErrCode AuthorizationExtensionContext::StartModalDialogForResult(const AAFwk::Want &want) const
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
@ -13,31 +13,31 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "authentication_extension_module_loader.h"
|
||||
#include "authorization_extension_module_loader.h"
|
||||
|
||||
#include "account_log_wrapper.h"
|
||||
#include "authentication_extension.h"
|
||||
#include "authorization_extension.h"
|
||||
|
||||
using namespace OHOS::AccountSA;
|
||||
namespace {
|
||||
const std::map<std::string, std::string> g_params = {{"type", "19"}, {"name", "AppAccountAuthorizationExtension"}};
|
||||
}
|
||||
namespace OHOS::AbilityRuntime {
|
||||
AuthenticationExtensionModuleLoader::AuthenticationExtensionModuleLoader() = default;
|
||||
AuthenticationExtensionModuleLoader::~AuthenticationExtensionModuleLoader() = default;
|
||||
AuthorizationExtensionModuleLoader::AuthorizationExtensionModuleLoader() = default;
|
||||
AuthorizationExtensionModuleLoader::~AuthorizationExtensionModuleLoader() = default;
|
||||
|
||||
Extension *AuthenticationExtensionModuleLoader::Create(const std::unique_ptr<Runtime> &runtime) const
|
||||
Extension *AuthorizationExtensionModuleLoader::Create(const std::unique_ptr<Runtime> &runtime) const
|
||||
{
|
||||
return AuthenticationExtension::Create(runtime);
|
||||
return AuthorizationExtension::Create(runtime);
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> AuthenticationExtensionModuleLoader::GetParams()
|
||||
std::map<std::string, std::string> AuthorizationExtensionModuleLoader::GetParams()
|
||||
{
|
||||
return g_params;
|
||||
}
|
||||
|
||||
extern "C" __attribute__((visibility("default"))) void *OHOS_EXTENSION_GetExtensionModule()
|
||||
{
|
||||
return &AuthenticationExtensionModuleLoader::GetInstance();
|
||||
return &AuthorizationExtensionModuleLoader::GetInstance();
|
||||
}
|
||||
} // namespace OHOS::AbilityRuntime
|
@ -52,18 +52,18 @@ config("app_account_innerkits_public_config") {
|
||||
|
||||
ohos_shared_library("app_account_innerkits") {
|
||||
sources = [
|
||||
"${app_account_extension_path}/src/authentication_extension.cpp",
|
||||
"${app_account_kits_path}/src/napi_app_account_authentication_extension.cpp",
|
||||
"${app_account_extension_path}/src/authorization_extension.cpp",
|
||||
"${app_account_kits_path}/src/napi_app_account_authorization_extension.cpp",
|
||||
"src/app_account.cpp",
|
||||
"src/app_account_authentication_extension_callback_client.cpp",
|
||||
"src/app_account_authentication_extension_callback_proxy.cpp",
|
||||
"src/app_account_authentication_extension_callback_service.cpp",
|
||||
"src/app_account_authentication_extension_callback_stub.cpp",
|
||||
"src/app_account_authentication_extension_service.cpp",
|
||||
"src/app_account_authentication_extension_stub.cpp",
|
||||
"src/app_account_authenticator_callback_proxy.cpp",
|
||||
"src/app_account_authenticator_callback_stub.cpp",
|
||||
"src/app_account_authenticator_stub.cpp",
|
||||
"src/app_account_authorization_extension_callback_client.cpp",
|
||||
"src/app_account_authorization_extension_callback_proxy.cpp",
|
||||
"src/app_account_authorization_extension_callback_service.cpp",
|
||||
"src/app_account_authorization_extension_callback_stub.cpp",
|
||||
"src/app_account_authorization_extension_service.cpp",
|
||||
"src/app_account_authorization_extension_stub.cpp",
|
||||
"src/app_account_common.cpp",
|
||||
"src/app_account_death_recipient.cpp",
|
||||
"src/app_account_event_listener.cpp",
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
ErrCode SetAuthenticatorProperties(const std::string &owner,
|
||||
const SetPropertiesOptions &options, const sptr<IAppAccountAuthenticatorCallback> &callback);
|
||||
ErrCode ExecuteRequest(
|
||||
const AccountCapabilityRequest &request, const sptr<IAppAccountAuthenticationExtensionCallback> &callback);
|
||||
const AccountCapabilityRequest &request, const sptr<IAppAccountAuthorizationExtensionCallback> &callback);
|
||||
|
||||
ErrCode SubscribeAppAccount(const std::shared_ptr<AppAccountSubscriber> &subscriber);
|
||||
ErrCode UnsubscribeAppAccount(const std::shared_ptr<AppAccountSubscriber> &subscriber);
|
||||
|
@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATION_EXTENSION_SERVICE_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATION_EXTENSION_SERVICE_H
|
||||
|
||||
#include <string>
|
||||
#include "account_error_no.h"
|
||||
#include "app_account_common.h"
|
||||
#include "app_account_authentication_extension_callback_client.h"
|
||||
#include "app_account_authentication_extension_stub.h"
|
||||
#include "napi_app_account_authentication_extension.h"
|
||||
#include "want.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class AppAccountAuthenticationExtensionService : public AppAccountAuthenticationExtensionStub {
|
||||
public:
|
||||
explicit AppAccountAuthenticationExtensionService(
|
||||
const std::shared_ptr<AccountJsKit::JsAuthenticationExtension> &extension);
|
||||
~AppAccountAuthenticationExtensionService() override;
|
||||
ErrCode StartAuthentication(const AuthenticationRequest &request) override;
|
||||
|
||||
private:
|
||||
ErrCode CheckAndInitExecEnv(const sptr<IAppAccountAuthenticationExtensionCallback> &callback,
|
||||
AppAccountAuthenticationExtensionCallbackClient **callbackClient);
|
||||
std::shared_ptr<AccountJsKit::JsAuthenticationExtension> innerExtension_;
|
||||
DISALLOW_COPY_AND_MOVE(AppAccountAuthenticationExtensionService);
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATION_EXTENSION_SERVICE_H
|
@ -13,24 +13,24 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATION_EXTENSION_CALLBACK_CLIENT_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATION_EXTENSION_CALLBACK_CLIENT_H
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHORIZATION_EXTENSION_CALLBACK_CLIENT_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHORIZATION_EXTENSION_CALLBACK_CLIENT_H
|
||||
|
||||
#include "app_account_authentication_extension_callback.h"
|
||||
#include "app_account_authentication_extension_callback_proxy.h"
|
||||
#include "app_account_authorization_extension_callback.h"
|
||||
#include "app_account_authorization_extension_callback_proxy.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class AppAccountAuthenticationExtensionCallbackClient : public AppAccountAuthenticationExtensionCallback {
|
||||
class AppAccountAuthorizationExtensionCallbackClient : public AppAccountAuthorizationExtensionCallback {
|
||||
public:
|
||||
explicit AppAccountAuthenticationExtensionCallbackClient(
|
||||
const sptr<IAppAccountAuthenticationExtensionCallback> &proxy);
|
||||
virtual ~AppAccountAuthenticationExtensionCallbackClient();
|
||||
explicit AppAccountAuthorizationExtensionCallbackClient(
|
||||
const sptr<IAppAccountAuthorizationExtensionCallback> &proxy);
|
||||
virtual ~AppAccountAuthorizationExtensionCallbackClient();
|
||||
void OnResult(const int32_t errCode, const AAFwk::WantParams ¶meters) override;
|
||||
|
||||
private:
|
||||
sptr<IAppAccountAuthenticationExtensionCallback> proxy_;
|
||||
sptr<IAppAccountAuthorizationExtensionCallback> proxy_;
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATION_EXTENSION_CALLBACK_CLIENT_H
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHORIZATION_EXTENSION_CALLBACK_CLIENT_H
|
@ -13,26 +13,26 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATION_EXTENSION_CALLBACK_PROXY_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATION_EXTENSION_CALLBACK_PROXY_H
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHORIZATION_EXTENSION_CALLBACK_PROXY_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHORIZATION_EXTENSION_CALLBACK_PROXY_H
|
||||
|
||||
#include "iapp_account_authentication_extension_callback.h"
|
||||
#include "iapp_account_authorization_extension_callback.h"
|
||||
#include "iremote_proxy.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class AppAccountAuthenticationExtensionCallbackProxy : public IRemoteProxy<IAppAccountAuthenticationExtensionCallback> {
|
||||
class AppAccountAuthorizationExtensionCallbackProxy : public IRemoteProxy<IAppAccountAuthorizationExtensionCallback> {
|
||||
public:
|
||||
explicit AppAccountAuthenticationExtensionCallbackProxy(const sptr<IRemoteObject> &object);
|
||||
~AppAccountAuthenticationExtensionCallbackProxy();
|
||||
explicit AppAccountAuthorizationExtensionCallbackProxy(const sptr<IRemoteObject> &object);
|
||||
~AppAccountAuthorizationExtensionCallbackProxy();
|
||||
void OnResult(const int32_t errCode, const AAFwk::WantParams ¶meters) override;
|
||||
|
||||
private:
|
||||
ErrCode SendRequest(IAppAccountAuthenticationExtensionCallback::Message code, MessageParcel &data);
|
||||
ErrCode SendRequest(IAppAccountAuthorizationExtensionCallback::Message code, MessageParcel &data);
|
||||
|
||||
private:
|
||||
static inline BrokerDelegator<AppAccountAuthenticationExtensionCallbackProxy> delegator_;
|
||||
static inline BrokerDelegator<AppAccountAuthorizationExtensionCallbackProxy> delegator_;
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATION_EXTENSION_CALLBACK_PROXY_H
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHORIZATION_EXTENSION_CALLBACK_PROXY_H
|
@ -13,25 +13,25 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATION_EXTENSION_CALLBACK_SERVICE_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATION_EXTENSION_CALLBACK_SERVICE_H
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHORIZATION_EXTENSION_CALLBACK_SERVICE_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHORIZATION_EXTENSION_CALLBACK_SERVICE_H
|
||||
|
||||
#include "app_account_authentication_extension_callback.h"
|
||||
#include "app_account_authentication_extension_callback_stub.h"
|
||||
#include "app_account_authorization_extension_callback.h"
|
||||
#include "app_account_authorization_extension_callback_stub.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class AppAccountAuthenticationExtensionCallbackService : public AppAccountAuthenticationExtensionCallbackStub {
|
||||
class AppAccountAuthorizationExtensionCallbackService : public AppAccountAuthorizationExtensionCallbackStub {
|
||||
public:
|
||||
AppAccountAuthenticationExtensionCallbackService(
|
||||
const std::shared_ptr<AppAccountAuthenticationExtensionCallback>& callback);
|
||||
~AppAccountAuthenticationExtensionCallbackService() override;
|
||||
AppAccountAuthorizationExtensionCallbackService(
|
||||
const std::shared_ptr<AppAccountAuthorizationExtensionCallback>& callback);
|
||||
~AppAccountAuthorizationExtensionCallbackService() override;
|
||||
void OnResult(const int32_t errCode, const AAFwk::WantParams& parameters) override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<AppAccountAuthenticationExtensionCallback> innerCallback_;
|
||||
DISALLOW_COPY_AND_MOVE(AppAccountAuthenticationExtensionCallbackService);
|
||||
std::shared_ptr<AppAccountAuthorizationExtensionCallback> innerCallback_;
|
||||
DISALLOW_COPY_AND_MOVE(AppAccountAuthorizationExtensionCallbackService);
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATION_EXTENSION_CALLBACK_SERVICE_H
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHORIZATION_EXTENSION_CALLBACK_SERVICE_H
|
@ -13,20 +13,20 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATION_EXTENSION_CALLBACK_STUB_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATION_EXTENSION_CALLBACK_STUB_H
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHORIZATION_EXTENSION_CALLBACK_STUB_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHORIZATION_EXTENSION_CALLBACK_STUB_H
|
||||
|
||||
#include <map>
|
||||
#include "account_error_no.h"
|
||||
#include "iapp_account_authentication_extension_callback.h"
|
||||
#include "iapp_account_authorization_extension_callback.h"
|
||||
#include "iremote_stub.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class AppAccountAuthenticationExtensionCallbackStub : public IRemoteStub<IAppAccountAuthenticationExtensionCallback> {
|
||||
class AppAccountAuthorizationExtensionCallbackStub : public IRemoteStub<IAppAccountAuthorizationExtensionCallback> {
|
||||
public:
|
||||
AppAccountAuthenticationExtensionCallbackStub();
|
||||
~AppAccountAuthenticationExtensionCallbackStub();
|
||||
AppAccountAuthorizationExtensionCallbackStub();
|
||||
~AppAccountAuthorizationExtensionCallbackStub();
|
||||
int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
|
||||
|
||||
private:
|
||||
@ -35,4 +35,4 @@ private:
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATION_EXTENSION_CALLBACK_STUB_H
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHORIZATION_EXTENSION_CALLBACK_STUB_H
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHORIZATION_EXTENSION_SERVICE_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHORIZATION_EXTENSION_SERVICE_H
|
||||
|
||||
#include <string>
|
||||
#include "account_error_no.h"
|
||||
#include "app_account_common.h"
|
||||
#include "app_account_authorization_extension_callback_client.h"
|
||||
#include "app_account_authorization_extension_stub.h"
|
||||
#include "napi_app_account_authorization_extension.h"
|
||||
#include "want.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class AppAccountAuthorizationExtensionService : public AppAccountAuthorizationExtensionStub {
|
||||
public:
|
||||
explicit AppAccountAuthorizationExtensionService(
|
||||
const std::shared_ptr<AccountJsKit::JsAuthorizationExtension> &extension);
|
||||
~AppAccountAuthorizationExtensionService() override;
|
||||
ErrCode StartAuthorization(const AuthorizationRequest &request) override;
|
||||
|
||||
private:
|
||||
ErrCode CheckAndInitExecEnv(const sptr<IAppAccountAuthorizationExtensionCallback> &callback,
|
||||
AppAccountAuthorizationExtensionCallbackClient **callbackClient);
|
||||
std::shared_ptr<AccountJsKit::JsAuthorizationExtension> innerExtension_;
|
||||
DISALLOW_COPY_AND_MOVE(AppAccountAuthorizationExtensionService);
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHORIZATION_EXTENSION_SERVICE_H
|
@ -13,33 +13,33 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATION_EXTENSION_STUB_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATION_EXTENSION_STUB_H
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHORIZATION_EXTENSION_STUB_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHORIZATION_EXTENSION_STUB_H
|
||||
|
||||
#include <map>
|
||||
#include "iapp_account_authentication_extension.h"
|
||||
#include "iapp_account_authorization_extension.h"
|
||||
#include "iremote_stub.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class AppAccountAuthenticationExtensionStub : public IRemoteStub<IAppAccountAuthenticationExtension> {
|
||||
class AppAccountAuthorizationExtensionStub : public IRemoteStub<IAppAccountAuthorizationExtension> {
|
||||
public:
|
||||
using MessageProcFunction = ErrCode (AppAccountAuthenticationExtensionStub::*)(
|
||||
using MessageProcFunction = ErrCode (AppAccountAuthorizationExtensionStub::*)(
|
||||
MessageParcel &data, MessageParcel &reply);
|
||||
|
||||
AppAccountAuthenticationExtensionStub();
|
||||
~AppAccountAuthenticationExtensionStub() override;
|
||||
AppAccountAuthorizationExtensionStub();
|
||||
~AppAccountAuthorizationExtensionStub() override;
|
||||
int OnRemoteRequest(
|
||||
uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
|
||||
|
||||
private:
|
||||
ErrCode ProcStartAuthentication(MessageParcel &data, MessageParcel &reply);
|
||||
ErrCode ProcStartAuthorization(MessageParcel &data, MessageParcel &reply);
|
||||
|
||||
private:
|
||||
static const std::map<uint32_t, MessageProcFunction> messageProcMap_;
|
||||
|
||||
DISALLOW_COPY_AND_MOVE(AppAccountAuthenticationExtensionStub);
|
||||
DISALLOW_COPY_AND_MOVE(AppAccountAuthorizationExtensionStub);
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHENTICATION_EXTENSION_STUB_H
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_AUTHORIZATION_EXTENSION_STUB_H
|
@ -17,7 +17,7 @@
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_COMMON_H
|
||||
|
||||
#include <string>
|
||||
#include "iapp_account_authentication_extension_callback.h"
|
||||
#include "iapp_account_authorization_extension_callback.h"
|
||||
#include "iapp_account_authenticator_callback.h"
|
||||
#include "want.h"
|
||||
|
||||
@ -116,13 +116,13 @@ enum AuthenticatorAction {
|
||||
AUTH,
|
||||
};
|
||||
|
||||
struct AuthenticationRequest {
|
||||
AuthenticationRequest();
|
||||
AuthenticationRequest(const int32_t &callingUid, const AAFwk::WantParams ¶meters,
|
||||
const sptr<IAppAccountAuthenticationExtensionCallback> &callback);
|
||||
struct AuthorizationRequest {
|
||||
AuthorizationRequest();
|
||||
AuthorizationRequest(const int32_t &callingUid, const AAFwk::WantParams ¶meters,
|
||||
const sptr<IAppAccountAuthorizationExtensionCallback> &callback);
|
||||
int32_t callerUid = -1;
|
||||
AAFwk::WantParams parameters;
|
||||
sptr<IAppAccountAuthenticationExtensionCallback> callback = nullptr;
|
||||
sptr<IAppAccountAuthorizationExtensionCallback> callback = nullptr;
|
||||
};
|
||||
|
||||
struct AccountCapabilityRequest : public Parcelable {
|
||||
|
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_IAPP_ACCOUNT_AUTHENTICATION_EXTENSION_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_IAPP_ACCOUNT_AUTHENTICATION_EXTENSION_H
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_IAPP_ACCOUNT_AUTHORIZATION_EXTENSION_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_IAPP_ACCOUNT_AUTHORIZATION_EXTENSION_H
|
||||
|
||||
#include <string>
|
||||
#include <iremote_broker.h>
|
||||
@ -23,14 +23,14 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class IAppAccountAuthenticationExtension : public IRemoteBroker {
|
||||
class IAppAccountAuthorizationExtension : public IRemoteBroker {
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.accountfwk.IAppAccountAuthenticationExtension");
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.accountfwk.IAppAccountAuthorizationExtension");
|
||||
enum Message {
|
||||
APP_AUTHENTICATE_EXTENSION_START_AUTHENTICATION = 0,
|
||||
APP_AUTHORIZATION_EXTENSION_START_AUTHENTICATION = 0,
|
||||
};
|
||||
virtual ErrCode StartAuthentication(const AuthenticationRequest &request) = 0;
|
||||
virtual ErrCode StartAuthorization(const AuthorizationRequest &request) = 0;
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_IAPP_ACCOUNT_AUTHENTICATION_EXTENSION_H
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_IAPP_ACCOUNT_AUTHORIZATION_EXTENSION_H
|
@ -13,23 +13,23 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_IAPP_ACCOUNT_AUTHENTICATION_EXTENSION_CALLBACK_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_IAPP_ACCOUNT_AUTHENTICATION_EXTENSION_CALLBACK_H
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_IAPP_ACCOUNT_AUTHORIZATION_EXTENSION_CALLBACK_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_IAPP_ACCOUNT_AUTHORIZATION_EXTENSION_CALLBACK_H
|
||||
|
||||
#include <iremote_broker.h>
|
||||
#include "want.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class IAppAccountAuthenticationExtensionCallback : public IRemoteBroker {
|
||||
class IAppAccountAuthorizationExtensionCallback : public IRemoteBroker {
|
||||
public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.accountfwk.IAppAccountAuthenticationExtensionCallback");
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.accountfwk.IAppAccountAuthorizationExtensionCallback");
|
||||
enum Message {
|
||||
APP_ACCOUNT_AUTHENTICATION_EXTENSION_CALLBACK_ON_RESULT = 0,
|
||||
APP_ACCOUNT_AUTHORIZATION_EXTENSION_CALLBACK_ON_RESULT = 0,
|
||||
};
|
||||
|
||||
virtual void OnResult(const int32_t errCode, const AAFwk::WantParams& parameters) = 0;
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_IAPP_ACCOUNT_AUTHENTICATION_EXTENSION_CALLBACK_H
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_IAPP_ACCOUNT_AUTHORIZATION_EXTENSION_CALLBACK_H
|
@ -17,8 +17,8 @@
|
||||
"non-virtual thunk to OHOS::AccountSA::AppAccountAuthenticatorCallbackStub::~AppAccountAuthenticatorCallbackStub()";
|
||||
"non-virtual thunk to OHOS::AccountSA::AppAccountAuthenticatorStub::~AppAccountAuthenticatorStub()";
|
||||
"non-virtual thunk to OHOS::AccountSA::AppAccountEventStub::~AppAccountEventStub()";
|
||||
"non-virtual thunk to OHOS::AccountSA::AppAccountAuthenticationExtensionCallbackStub::~AppAccountAuthenticationExtensionCallbackStub()";
|
||||
"virtual thunk to OHOS::AccountSA::AppAccountAuthenticationExtensionCallbackStub::~AppAccountAuthenticationExtensionCallbackStub()";
|
||||
"non-virtual thunk to OHOS::AccountSA::AppAccountAuthorizationExtensionCallbackStub::~AppAccountAuthorizationExtensionCallbackStub()";
|
||||
"virtual thunk to OHOS::AccountSA::AppAccountAuthorizationExtensionCallbackStub::~AppAccountAuthorizationExtensionCallbackStub()";
|
||||
"OHOS::AccountSA::AppAccount::GetInstance()";
|
||||
"OHOS::AccountSA::AppAccount::UnsubscribeAppAccount(std::__h::shared_ptr<OHOS::AccountSA::AppAccountSubscriber> const&)";
|
||||
"OHOS::AccountSA::AppAccountAuthenticatorCallbackProxy::AppAccountAuthenticatorCallbackProxy(OHOS::sptr<OHOS::IRemoteObject> const&)";
|
||||
@ -38,10 +38,10 @@
|
||||
"OHOS::AccountSA::AppAccountEventStub::ReadParcelableVector<OHOS::AccountSA::AppAccountInfo>(std::__h::vector<OHOS::AccountSA::AppAccountInfo, std::__h::allocator<OHOS::AccountSA::AppAccountInfo>>&, OHOS::MessageParcel&)";
|
||||
"OHOS::AccountSA::AppAccountEventStub::~AppAccountEventStub()";
|
||||
"OHOS::AccountSA::AppAccountInfo::AppAccountInfo()";
|
||||
"OHOS::AccountSA::AuthenticationRequest::AuthenticationRequest()";
|
||||
"OHOS::AbilityRuntime::JsAuthenticationExtension::StartAuthenticationWork(uv_work_s*, int)";
|
||||
"OHOS::AccountSA::AppAccountAuthenticationExtensionService::AppAccountAuthenticationExtensionService(std::__h::shared_ptr<OHOS::AccountJsKit::JsAuthenticationExtension> const&)";
|
||||
"OHOS::AccountSA::AppAccountAuthenticationExtensionCallbackProxy::AppAccountAuthenticationExtensionCallbackProxy(OHOS::sptr<OHOS::IRemoteObject> const&)";
|
||||
"OHOS::AccountSA::AuthorizationRequest::AuthorizationRequest()";
|
||||
"OHOS::AbilityRuntime::JsAuthorizationExtension::StartAuthorizationWork(uv_work_s*, int)";
|
||||
"OHOS::AccountSA::AppAccountAuthorizationExtensionService::AppAccountAuthorizationExtensionService(std::__h::shared_ptr<OHOS::AccountJsKit::JsAuthorizationExtension> const&)";
|
||||
"OHOS::AccountSA::AppAccountAuthorizationExtensionCallbackProxy::AppAccountAuthorizationExtensionCallbackProxy(OHOS::sptr<OHOS::IRemoteObject> const&)";
|
||||
"OHOS::AccountSA::AppAccountInfo::GetName(std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>&) const";
|
||||
"OHOS::AccountSA::AppAccountInfo::GetOwner(std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>&)";
|
||||
"OHOS::AccountSA::AppAccountManager::AddAccount(std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>> const&, std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>> const&)";
|
||||
@ -168,19 +168,19 @@
|
||||
"OHOS::AccountSA::AppAccountInfo::GetOwner()";
|
||||
"OHOS::AccountSA::AppAccountInfo::WriteStringMap(std::__h::map<std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>, std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>, std::__h::less<std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>>, std::__h::allocator<std::__h::pair<std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>> const, std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>>>> const&, OHOS::Parcel&) const";
|
||||
"OHOS::AccountSA::AppAccountInfo::ReadStringMap(std::__h::map<std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>, std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>, std::__h::less<std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>>, std::__h::allocator<std::__h::pair<std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>> const, std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>>>>>&, OHOS::Parcel&)";
|
||||
"OHOS::AccountSA::AppAccountAuthenticationExtensionCallbackStub::AppAccountAuthenticationExtensionCallbackStub()";
|
||||
"OHOS::AccountSA::AppAccountAuthenticationExtensionCallbackStub::~AppAccountAuthenticationExtensionCallbackStub()";
|
||||
"OHOS::AccountSA::AppAccountAuthenticationExtensionCallbackStub::OnRemoteRequest(unsigned int, OHOS::MessageParcel&, OHOS::MessageParcel&, OHOS::MessageOption&)";
|
||||
"OHOS::AccountSA::AppAccountManager::ExecuteRequest(OHOS::AccountSA::AccountCapabilityRequest const&, OHOS::sptr<OHOS::AccountSA::IAppAccountAuthenticationExtensionCallback> const&)";
|
||||
"OHOS::AccountSA::AppAccountAuthenticationExtensionCallbackService::AppAccountAuthenticationExtensionCallbackService(std::__h::shared_ptr<OHOS::AccountSA::AppAccountAuthenticationExtensionCallback> const&)";
|
||||
"OHOS::AccountSA::AppAccountAuthenticationExtensionStub::AppAccountAuthenticationExtensionStub()";
|
||||
"OHOS::AccountSA::AppAccountAuthenticationExtensionStub::~AppAccountAuthenticationExtensionStub()";
|
||||
"OHOS::AccountSA::AppAccountAuthenticationExtensionCallbackClient::AppAccountAuthenticationExtensionCallbackClient(OHOS::sptr<OHOS::AccountSA::IAppAccountAuthenticationExtensionCallback> const&)";
|
||||
"OHOS::AccountSA::AppAccountAuthenticationExtensionStub::OnRemoteRequest(unsigned int, OHOS::MessageParcel&, OHOS::MessageParcel&, OHOS::MessageOption&)";
|
||||
"OHOS::AccountSA::AppAccountAuthenticationExtensionStub::~AppAccountAuthenticationExtensionStub()";
|
||||
"OHOS::AccountSA::AppAccountAuthenticationExtensionStub::~AppAccountAuthenticationExtensionStub()";
|
||||
"non-virtual thunk to OHOS::AccountSA::AppAccountAuthenticationExtensionStub::~AppAccountAuthenticationExtensionStub()";
|
||||
"virtual thunk to OHOS::AccountSA::AppAccountAuthenticationExtensionStub::~AppAccountAuthenticationExtensionStub()";
|
||||
"OHOS::AccountSA::AppAccountAuthorizationExtensionCallbackStub::AppAccountAuthorizationExtensionCallbackStub()";
|
||||
"OHOS::AccountSA::AppAccountAuthorizationExtensionCallbackStub::~AppAccountAuthorizationExtensionCallbackStub()";
|
||||
"OHOS::AccountSA::AppAccountAuthorizationExtensionCallbackStub::OnRemoteRequest(unsigned int, OHOS::MessageParcel&, OHOS::MessageParcel&, OHOS::MessageOption&)";
|
||||
"OHOS::AccountSA::AppAccountManager::ExecuteRequest(OHOS::AccountSA::AccountCapabilityRequest const&, OHOS::sptr<OHOS::AccountSA::IAppAccountAuthorizationExtensionCallback> const&)";
|
||||
"OHOS::AccountSA::AppAccountAuthorizationExtensionCallbackService::AppAccountAuthorizationExtensionCallbackService(std::__h::shared_ptr<OHOS::AccountSA::AppAccountAuthorizationExtensionCallback> const&)";
|
||||
"OHOS::AccountSA::AppAccountAuthorizationExtensionStub::AppAccountAuthorizationExtensionStub()";
|
||||
"OHOS::AccountSA::AppAccountAuthorizationExtensionStub::~AppAccountAuthorizationExtensionStub()";
|
||||
"OHOS::AccountSA::AppAccountAuthorizationExtensionCallbackClient::AppAccountAuthorizationExtensionCallbackClient(OHOS::sptr<OHOS::AccountSA::IAppAccountAuthorizationExtensionCallback> const&)";
|
||||
"OHOS::AccountSA::AppAccountAuthorizationExtensionStub::OnRemoteRequest(unsigned int, OHOS::MessageParcel&, OHOS::MessageParcel&, OHOS::MessageOption&)";
|
||||
"OHOS::AccountSA::AppAccountAuthorizationExtensionStub::~AppAccountAuthorizationExtensionStub()";
|
||||
"OHOS::AccountSA::AppAccountAuthorizationExtensionStub::~AppAccountAuthorizationExtensionStub()";
|
||||
"non-virtual thunk to OHOS::AccountSA::AppAccountAuthorizationExtensionStub::~AppAccountAuthorizationExtensionStub()";
|
||||
"virtual thunk to OHOS::AccountSA::AppAccountAuthorizationExtensionStub::~AppAccountAuthorizationExtensionStub()";
|
||||
};
|
||||
local:
|
||||
*;
|
||||
|
@ -487,7 +487,7 @@ ErrCode AppAccount::QueryAllAccessibleAccounts(
|
||||
}
|
||||
|
||||
ErrCode AppAccount::ExecuteRequest(
|
||||
const AccountCapabilityRequest &request, const sptr<IAppAccountAuthenticationExtensionCallback> &callback)
|
||||
const AccountCapabilityRequest &request, const sptr<IAppAccountAuthorizationExtensionCallback> &callback)
|
||||
{
|
||||
if (callback == nullptr) {
|
||||
ACCOUNT_LOGE("callback is nullptr");
|
||||
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "app_account_authentication_extension_service.h"
|
||||
|
||||
#include "account_log_wrapper.h"
|
||||
#include "app_account_authentication_extension_callback_client.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
AppAccountAuthenticationExtensionService::AppAccountAuthenticationExtensionService(
|
||||
const std::shared_ptr<AccountJsKit::JsAuthenticationExtension> &extension)
|
||||
: innerExtension_(extension)
|
||||
{}
|
||||
|
||||
AppAccountAuthenticationExtensionService::~AppAccountAuthenticationExtensionService()
|
||||
{}
|
||||
|
||||
ErrCode AppAccountAuthenticationExtensionService::CheckAndInitExecEnv(
|
||||
const sptr<IAppAccountAuthenticationExtensionCallback> &callback,
|
||||
AppAccountAuthenticationExtensionCallbackClient **callbackClient)
|
||||
{
|
||||
if (innerExtension_ == nullptr) {
|
||||
ACCOUNT_LOGE("innerExtension_ is nullptr");
|
||||
return ERR_ACCOUNT_COMMON_NULL_PTR_ERROR;
|
||||
}
|
||||
*callbackClient = new (std::nothrow) AppAccountAuthenticationExtensionCallbackClient(callback);
|
||||
if (*callbackClient == nullptr) {
|
||||
ACCOUNT_LOGE("failed to create app account authentication extension callback client");
|
||||
return ERR_ACCOUNT_COMMON_INSUFFICIENT_MEMORY_ERROR;
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AppAccountAuthenticationExtensionService::StartAuthentication(const AuthenticationRequest &request)
|
||||
{
|
||||
AppAccountAuthenticationExtensionCallbackClient *callbackClient = nullptr;
|
||||
ErrCode errCode = CheckAndInitExecEnv(request.callback, &callbackClient);
|
||||
if (errCode != ERR_OK) {
|
||||
return errCode;
|
||||
}
|
||||
std::shared_ptr<AppAccountAuthenticationExtensionCallbackClient> callbackPtr(callbackClient);
|
||||
innerExtension_->StartAuthentication(request, callbackPtr, innerExtension_);
|
||||
return ERR_OK;
|
||||
}
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
@ -13,23 +13,23 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "app_account_authentication_extension_callback_client.h"
|
||||
#include "app_account_authorization_extension_callback_client.h"
|
||||
|
||||
#include "account_error_no.h"
|
||||
#include "account_log_wrapper.h"
|
||||
#include "app_account_authentication_extension_callback_proxy.h"
|
||||
#include "app_account_authorization_extension_callback_proxy.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
AppAccountAuthenticationExtensionCallbackClient::AppAccountAuthenticationExtensionCallbackClient(
|
||||
const sptr<IAppAccountAuthenticationExtensionCallback>& proxy)
|
||||
AppAccountAuthorizationExtensionCallbackClient::AppAccountAuthorizationExtensionCallbackClient(
|
||||
const sptr<IAppAccountAuthorizationExtensionCallback>& proxy)
|
||||
: proxy_(proxy)
|
||||
{}
|
||||
|
||||
AppAccountAuthenticationExtensionCallbackClient::~AppAccountAuthenticationExtensionCallbackClient()
|
||||
AppAccountAuthorizationExtensionCallbackClient::~AppAccountAuthorizationExtensionCallbackClient()
|
||||
{}
|
||||
|
||||
void AppAccountAuthenticationExtensionCallbackClient::OnResult(
|
||||
void AppAccountAuthorizationExtensionCallbackClient::OnResult(
|
||||
const int32_t errCode, const AAFwk::WantParams& parameters)
|
||||
{
|
||||
if (proxy_ != nullptr) {
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "app_account_authentication_extension_callback_proxy.h"
|
||||
#include "app_account_authorization_extension_callback_proxy.h"
|
||||
|
||||
#include <securec.h>
|
||||
#include "account_error_no.h"
|
||||
@ -22,16 +22,16 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
AppAccountAuthenticationExtensionCallbackProxy::AppAccountAuthenticationExtensionCallbackProxy(
|
||||
AppAccountAuthorizationExtensionCallbackProxy::AppAccountAuthorizationExtensionCallbackProxy(
|
||||
const sptr<IRemoteObject> &object)
|
||||
: IRemoteProxy<IAppAccountAuthenticationExtensionCallback>(object)
|
||||
: IRemoteProxy<IAppAccountAuthorizationExtensionCallback>(object)
|
||||
{}
|
||||
|
||||
AppAccountAuthenticationExtensionCallbackProxy::~AppAccountAuthenticationExtensionCallbackProxy()
|
||||
AppAccountAuthorizationExtensionCallbackProxy::~AppAccountAuthorizationExtensionCallbackProxy()
|
||||
{}
|
||||
|
||||
ErrCode AppAccountAuthenticationExtensionCallbackProxy::SendRequest(
|
||||
IAppAccountAuthenticationExtensionCallback::Message code, MessageParcel &data)
|
||||
ErrCode AppAccountAuthorizationExtensionCallbackProxy::SendRequest(
|
||||
IAppAccountAuthorizationExtensionCallback::Message code, MessageParcel &data)
|
||||
{
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
@ -43,7 +43,7 @@ ErrCode AppAccountAuthenticationExtensionCallbackProxy::SendRequest(
|
||||
return remote->SendRequest(static_cast<uint32_t>(code), data, reply, option);
|
||||
}
|
||||
|
||||
void AppAccountAuthenticationExtensionCallbackProxy::OnResult(
|
||||
void AppAccountAuthorizationExtensionCallbackProxy::OnResult(
|
||||
const int32_t errCode, const AAFwk::WantParams ¶meters)
|
||||
{
|
||||
MessageParcel data;
|
||||
@ -60,7 +60,7 @@ void AppAccountAuthenticationExtensionCallbackProxy::OnResult(
|
||||
return;
|
||||
}
|
||||
ErrCode result = SendRequest(
|
||||
IAppAccountAuthenticationExtensionCallback::Message::APP_ACCOUNT_AUTHENTICATION_EXTENSION_CALLBACK_ON_RESULT,
|
||||
IAppAccountAuthorizationExtensionCallback::Message::APP_ACCOUNT_AUTHORIZATION_EXTENSION_CALLBACK_ON_RESULT,
|
||||
data);
|
||||
if (result != ERR_OK) {
|
||||
ACCOUNT_LOGE("failed to send request, error code: %{public}d", result);
|
@ -13,20 +13,20 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "app_account_authentication_extension_callback_service.h"
|
||||
#include "app_account_authorization_extension_callback_service.h"
|
||||
#include "account_log_wrapper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
AppAccountAuthenticationExtensionCallbackService::AppAccountAuthenticationExtensionCallbackService(
|
||||
const std::shared_ptr<AppAccountAuthenticationExtensionCallback>& callback)
|
||||
AppAccountAuthorizationExtensionCallbackService::AppAccountAuthorizationExtensionCallbackService(
|
||||
const std::shared_ptr<AppAccountAuthorizationExtensionCallback>& callback)
|
||||
: innerCallback_(callback)
|
||||
{}
|
||||
|
||||
AppAccountAuthenticationExtensionCallbackService::~AppAccountAuthenticationExtensionCallbackService()
|
||||
AppAccountAuthorizationExtensionCallbackService::~AppAccountAuthorizationExtensionCallbackService()
|
||||
{}
|
||||
|
||||
void AppAccountAuthenticationExtensionCallbackService::OnResult(
|
||||
void AppAccountAuthorizationExtensionCallbackService::OnResult(
|
||||
const int32_t errCode, const AAFwk::WantParams& parameters)
|
||||
{
|
||||
if (innerCallback_ == nullptr) {
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "app_account_authentication_extension_callback_stub.h"
|
||||
#include "app_account_authorization_extension_callback_stub.h"
|
||||
|
||||
#include <securec.h>
|
||||
#include "account_log_wrapper.h"
|
||||
@ -23,13 +23,13 @@
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
|
||||
AppAccountAuthenticationExtensionCallbackStub::AppAccountAuthenticationExtensionCallbackStub()
|
||||
AppAccountAuthorizationExtensionCallbackStub::AppAccountAuthorizationExtensionCallbackStub()
|
||||
{}
|
||||
|
||||
AppAccountAuthenticationExtensionCallbackStub::~AppAccountAuthenticationExtensionCallbackStub()
|
||||
AppAccountAuthorizationExtensionCallbackStub::~AppAccountAuthorizationExtensionCallbackStub()
|
||||
{}
|
||||
|
||||
int32_t AppAccountAuthenticationExtensionCallbackStub::OnRemoteRequest(
|
||||
int32_t AppAccountAuthorizationExtensionCallbackStub::OnRemoteRequest(
|
||||
std::uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
if (data.ReadInterfaceToken() != GetDescriptor()) {
|
||||
@ -39,7 +39,7 @@ int32_t AppAccountAuthenticationExtensionCallbackStub::OnRemoteRequest(
|
||||
return ProcOnResult(data, reply);
|
||||
}
|
||||
|
||||
int32_t AppAccountAuthenticationExtensionCallbackStub::ProcOnResult(MessageParcel &data, MessageParcel &reply)
|
||||
int32_t AppAccountAuthorizationExtensionCallbackStub::ProcOnResult(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
int32_t result;
|
||||
if (!data.ReadInt32(result)) {
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "app_account_authorization_extension_service.h"
|
||||
|
||||
#include "account_log_wrapper.h"
|
||||
#include "app_account_authorization_extension_callback_client.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
AppAccountAuthorizationExtensionService::AppAccountAuthorizationExtensionService(
|
||||
const std::shared_ptr<AccountJsKit::JsAuthorizationExtension> &extension)
|
||||
: innerExtension_(extension)
|
||||
{}
|
||||
|
||||
AppAccountAuthorizationExtensionService::~AppAccountAuthorizationExtensionService()
|
||||
{}
|
||||
|
||||
ErrCode AppAccountAuthorizationExtensionService::CheckAndInitExecEnv(
|
||||
const sptr<IAppAccountAuthorizationExtensionCallback> &callback,
|
||||
AppAccountAuthorizationExtensionCallbackClient **callbackClient)
|
||||
{
|
||||
if (innerExtension_ == nullptr) {
|
||||
ACCOUNT_LOGE("innerExtension_ is nullptr");
|
||||
return ERR_ACCOUNT_COMMON_NULL_PTR_ERROR;
|
||||
}
|
||||
*callbackClient = new (std::nothrow) AppAccountAuthorizationExtensionCallbackClient(callback);
|
||||
if (*callbackClient == nullptr) {
|
||||
ACCOUNT_LOGE("failed to create app account authorization extension callback client");
|
||||
return ERR_ACCOUNT_COMMON_INSUFFICIENT_MEMORY_ERROR;
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AppAccountAuthorizationExtensionService::StartAuthorization(const AuthorizationRequest &request)
|
||||
{
|
||||
AppAccountAuthorizationExtensionCallbackClient *callbackClient = nullptr;
|
||||
ErrCode errCode = CheckAndInitExecEnv(request.callback, &callbackClient);
|
||||
if (errCode != ERR_OK) {
|
||||
return errCode;
|
||||
}
|
||||
std::shared_ptr<AppAccountAuthorizationExtensionCallbackClient> callbackPtr(callbackClient);
|
||||
innerExtension_->StartAuthorization(request, callbackPtr, innerExtension_);
|
||||
return ERR_OK;
|
||||
}
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "app_account_authentication_extension_stub.h"
|
||||
#include "app_account_authorization_extension_stub.h"
|
||||
|
||||
#include <securec.h>
|
||||
#include "account_error_no.h"
|
||||
@ -24,21 +24,21 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
AppAccountAuthenticationExtensionStub::AppAccountAuthenticationExtensionStub()
|
||||
AppAccountAuthorizationExtensionStub::AppAccountAuthorizationExtensionStub()
|
||||
{}
|
||||
|
||||
AppAccountAuthenticationExtensionStub::~AppAccountAuthenticationExtensionStub()
|
||||
AppAccountAuthorizationExtensionStub::~AppAccountAuthorizationExtensionStub()
|
||||
{}
|
||||
|
||||
const std::map<std::uint32_t, AppAccountAuthenticationExtensionStub::MessageProcFunction>
|
||||
AppAccountAuthenticationExtensionStub::messageProcMap_ = {
|
||||
const std::map<std::uint32_t, AppAccountAuthorizationExtensionStub::MessageProcFunction>
|
||||
AppAccountAuthorizationExtensionStub::messageProcMap_ = {
|
||||
{
|
||||
IAppAccountAuthenticationExtension::Message::APP_AUTHENTICATE_EXTENSION_START_AUTHENTICATION,
|
||||
&AppAccountAuthenticationExtensionStub::ProcStartAuthentication
|
||||
IAppAccountAuthorizationExtension::Message::APP_AUTHORIZATION_EXTENSION_START_AUTHENTICATION,
|
||||
&AppAccountAuthorizationExtensionStub::ProcStartAuthorization
|
||||
}
|
||||
};
|
||||
|
||||
int AppAccountAuthenticationExtensionStub::OnRemoteRequest(
|
||||
int AppAccountAuthorizationExtensionStub::OnRemoteRequest(
|
||||
uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
ACCOUNT_LOGD("Received stub message: %{public}d, callingUid: %{public}d", code, IPCSkeleton::GetCallingUid());
|
||||
@ -54,7 +54,7 @@ int AppAccountAuthenticationExtensionStub::OnRemoteRequest(
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
|
||||
static ErrCode ReadRequest(MessageParcel &data, AuthenticationRequest &request)
|
||||
static ErrCode ReadRequest(MessageParcel &data, AuthorizationRequest &request)
|
||||
{
|
||||
if (!data.ReadInt32(request.callerUid)) {
|
||||
ACCOUNT_LOGE("failed to write request callerUid");
|
||||
@ -66,7 +66,7 @@ static ErrCode ReadRequest(MessageParcel &data, AuthenticationRequest &request)
|
||||
return ERR_ACCOUNT_COMMON_READ_PARCEL_ERROR;
|
||||
}
|
||||
request.parameters = (*parameters);
|
||||
auto callback = iface_cast<IAppAccountAuthenticationExtensionCallback>(data.ReadRemoteObject());
|
||||
auto callback = iface_cast<IAppAccountAuthorizationExtensionCallback>(data.ReadRemoteObject());
|
||||
if (callback == nullptr) {
|
||||
ACCOUNT_LOGE("failed to read domain callback");
|
||||
return ERR_ACCOUNT_COMMON_READ_PARCEL_ERROR;
|
||||
@ -75,14 +75,14 @@ static ErrCode ReadRequest(MessageParcel &data, AuthenticationRequest &request)
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AppAccountAuthenticationExtensionStub::ProcStartAuthentication(MessageParcel &data, MessageParcel &reply)
|
||||
ErrCode AppAccountAuthorizationExtensionStub::ProcStartAuthorization(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
AuthenticationRequest request;
|
||||
AuthorizationRequest request;
|
||||
ErrCode result = ReadRequest(data, request);
|
||||
if (result != ERR_OK) {
|
||||
return result;
|
||||
}
|
||||
result = StartAuthentication(request);
|
||||
result = StartAuthorization(request);
|
||||
if (!reply.WriteInt32(result)) {
|
||||
ACCOUNT_LOGE("failed to write result");
|
||||
return ERR_ACCOUNT_COMMON_WRITE_PARCEL_ERROR;
|
@ -77,12 +77,12 @@ bool SelectAccountsOptions::ReadFromParcel(Parcel &parcel)
|
||||
return parcel.ReadStringVector(&allowedOwners) && parcel.ReadStringVector(&requiredLabels);
|
||||
}
|
||||
|
||||
AuthenticationRequest::AuthenticationRequest(const int32_t &callingUid, const AAFwk::WantParams ¶meters,
|
||||
const sptr<IAppAccountAuthenticationExtensionCallback> &callback)
|
||||
AuthorizationRequest::AuthorizationRequest(const int32_t &callingUid, const AAFwk::WantParams ¶meters,
|
||||
const sptr<IAppAccountAuthorizationExtensionCallback> &callback)
|
||||
: callerUid(callingUid), parameters(parameters), callback(callback)
|
||||
{}
|
||||
|
||||
AuthenticationRequest::AuthenticationRequest()
|
||||
AuthorizationRequest::AuthorizationRequest()
|
||||
{}
|
||||
|
||||
bool VerifyCredentialOptions::Marshalling(Parcel &parcel) const
|
||||
|
@ -248,7 +248,7 @@ ErrCode AppAccountManager::SetAuthenticatorProperties(const std::string &owner,
|
||||
}
|
||||
|
||||
ErrCode AppAccountManager::ExecuteRequest(
|
||||
const AccountCapabilityRequest &request, const sptr<IAppAccountAuthenticationExtensionCallback> &callback)
|
||||
const AccountCapabilityRequest &request, const sptr<IAppAccountAuthorizationExtensionCallback> &callback)
|
||||
{
|
||||
return AppAccount::GetInstance().ExecuteRequest(request, callback);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class AppAccountAuthenticationExtensionCallback {
|
||||
class AppAccountAuthorizationExtensionCallback {
|
||||
public:
|
||||
virtual void OnResult(const int32_t errCode, const AAFwk::WantParams& parameters) = 0;
|
||||
};
|
@ -507,7 +507,7 @@ public:
|
||||
const SetPropertiesOptions &options, const sptr<IAppAccountAuthenticatorCallback> &callback);
|
||||
|
||||
static ErrCode ExecuteRequest(
|
||||
const AccountCapabilityRequest &request, const sptr<IAppAccountAuthenticationExtensionCallback> &callback);
|
||||
const AccountCapabilityRequest &request, const sptr<IAppAccountAuthorizationExtensionCallback> &callback);
|
||||
/**
|
||||
* @brief Subscribes to the change events of accounts of the specified owners.
|
||||
* <p>
|
||||
|
@ -47,12 +47,12 @@ ohos_shared_library("appaccount") {
|
||||
|
||||
public_configs = [ ":appaccount_kit_config" ]
|
||||
sources = [
|
||||
"${app_account_extension_path}/src/authentication_extension.cpp",
|
||||
"${app_account_extension_path}/src/authorization_extension.cpp",
|
||||
"src/napi_account_capability_scheduler.cpp",
|
||||
"src/napi_app_account.cpp",
|
||||
"src/napi_app_account_authentication_extension.cpp",
|
||||
"src/napi_app_account_authenticator.cpp",
|
||||
"src/napi_app_account_authenticator_callback.cpp",
|
||||
"src/napi_app_account_authorization_extension.cpp",
|
||||
"src/napi_app_account_common.cpp",
|
||||
"src/napi_app_account_constant.cpp",
|
||||
"src/napi_app_account_module.cpp",
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <uv.h>
|
||||
|
||||
#include "account_error_no.h"
|
||||
#include "app_account_authentication_extension_callback_stub.h"
|
||||
#include "app_account_authorization_extension_callback_stub.h"
|
||||
#include "app_account_common.h"
|
||||
#include "iremote_object.h"
|
||||
#include "napi/native_api.h"
|
||||
@ -105,7 +105,7 @@ private:
|
||||
static napi_value ExecuteRequest(napi_env env, napi_callback_info cbInfo);
|
||||
};
|
||||
|
||||
class NapiExecuteRequestCallback : public AppAccountAuthenticationExtensionCallbackStub {
|
||||
class NapiExecuteRequestCallback : public AppAccountAuthorizationExtensionCallbackStub {
|
||||
public:
|
||||
NapiExecuteRequestCallback(napi_env env, napi_ref callbackRef, napi_deferred deferred, napi_ref requestRef);
|
||||
~NapiExecuteRequestCallback();
|
||||
|
@ -13,12 +13,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FOUNDATION_ABILITYRUNTIME_OHOS_JS_AUTHENTICATION_EXTENSION_H
|
||||
#define FOUNDATION_ABILITYRUNTIME_OHOS_JS_AUTHENTICATION_EXTENSION_H
|
||||
#ifndef FOUNDATION_ABILITYRUNTIME_OHOS_JS_AUTHORIZATION_EXTENSION_H
|
||||
#define FOUNDATION_ABILITYRUNTIME_OHOS_JS_AUTHORIZATION_EXTENSION_H
|
||||
|
||||
#include "app_account_authentication_extension_callback_client.h"
|
||||
#include "app_account_authorization_extension_callback_client.h"
|
||||
#include "app_account_common.h"
|
||||
#include "authentication_extension.h"
|
||||
#include "authorization_extension.h"
|
||||
#include "js_runtime.h"
|
||||
#include "napi_account_common.h"
|
||||
#include "native_engine/native_value.h"
|
||||
@ -28,19 +28,19 @@ namespace AccountJsKit {
|
||||
|
||||
using namespace OHOS::AbilityRuntime;
|
||||
/**
|
||||
* @brief Basic authentication components.
|
||||
* @brief Basic authorization components.
|
||||
*/
|
||||
class JsAuthenticationExtension : public AuthenticationExtension {
|
||||
class JsAuthorizationExtension : public AuthorizationExtension {
|
||||
public:
|
||||
JsAuthenticationExtension(JsRuntime &jsRuntime);
|
||||
~JsAuthenticationExtension() override;
|
||||
JsAuthorizationExtension(JsRuntime &jsRuntime);
|
||||
~JsAuthorizationExtension() override;
|
||||
/**
|
||||
* @brief Create JsAuthenticationExtension.
|
||||
* @brief Create JsAuthorizationExtension.
|
||||
*
|
||||
* @param runtime The runtime.
|
||||
* @return The JsAuthenticationExtension instance.
|
||||
* @return The JsAuthorizationExtension instance.
|
||||
*/
|
||||
static JsAuthenticationExtension *Create(const std::unique_ptr<Runtime> &runtime);
|
||||
static JsAuthorizationExtension *Create(const std::unique_ptr<Runtime> &runtime);
|
||||
|
||||
/**
|
||||
* @brief Init the extension.
|
||||
@ -63,9 +63,9 @@ public:
|
||||
*/
|
||||
void OnStart(const AAFwk::Want &want) override;
|
||||
|
||||
void StartAuthentication(const AccountSA::AuthenticationRequest &request,
|
||||
const std::shared_ptr<AccountSA::AppAccountAuthenticationExtensionCallbackClient> &callbackPtr,
|
||||
const std::shared_ptr<JsAuthenticationExtension> &extension);
|
||||
void StartAuthorization(const AccountSA::AuthorizationRequest &request,
|
||||
const std::shared_ptr<AccountSA::AppAccountAuthorizationExtensionCallbackClient> &callbackPtr,
|
||||
const std::shared_ptr<JsAuthorizationExtension> &extension);
|
||||
|
||||
sptr<IRemoteObject> OnConnect(const OHOS::AAFwk::Want &want) override;
|
||||
|
||||
@ -80,14 +80,14 @@ private:
|
||||
AccountJsKit::ThreadLockInfo lockInfo_;
|
||||
};
|
||||
|
||||
struct JsAppAAuthenticationExtensionParam : public AccountJsKit::CommonAsyncContext {
|
||||
JsAppAAuthenticationExtensionParam(){};
|
||||
JsAppAAuthenticationExtensionParam(napi_env napiEnv);
|
||||
std::shared_ptr<AccountSA::AppAccountAuthenticationExtensionCallbackClient> callback = nullptr;
|
||||
AccountSA::AuthenticationRequest request;
|
||||
std::shared_ptr<JsAuthenticationExtension> authenticationExtension = nullptr;
|
||||
struct JsAppAuthorizationExtensionParam : public AccountJsKit::CommonAsyncContext {
|
||||
JsAppAuthorizationExtensionParam(){};
|
||||
JsAppAuthorizationExtensionParam(napi_env napiEnv);
|
||||
std::shared_ptr<AccountSA::AppAccountAuthorizationExtensionCallbackClient> callback = nullptr;
|
||||
AccountSA::AuthorizationRequest request;
|
||||
std::shared_ptr<JsAuthorizationExtension> authorizationExtension = nullptr;
|
||||
ThreadLockInfo *lockInfo = nullptr;
|
||||
};
|
||||
} // namespace AccountJsKit
|
||||
} // namespace OHOS
|
||||
#endif // FOUNDATION_ABILITYRUNTIME_OHOS_JS_AUTHENTICATION_EXTENSION_H
|
||||
#endif // FOUNDATION_ABILITYRUNTIME_OHOS_JS_AUTHORIZATION_EXTENSION_H
|
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "napi_app_account_authentication_extension.h"
|
||||
#include "napi_app_account_authorization_extension.h"
|
||||
|
||||
#include <memory>
|
||||
#include <uv.h>
|
||||
@ -21,7 +21,7 @@
|
||||
#include "account_error_no.h"
|
||||
#include "account_log_wrapper.h"
|
||||
#include "account_permission_manager.h"
|
||||
#include "app_account_authentication_extension_service.h"
|
||||
#include "app_account_authorization_extension_service.h"
|
||||
#include "napi/native_api.h"
|
||||
#include "napi/native_node_api.h"
|
||||
#include "napi_account_common.h"
|
||||
@ -45,7 +45,7 @@ using namespace OHOS::AbilityRuntime;
|
||||
using namespace OHOS::AccountSA;
|
||||
|
||||
static bool GetExtentionCallbackCommonParam(napi_env env, napi_callback_info cbInfo,
|
||||
JsAppAAuthenticationExtensionParam **param, BusinessError &error, napi_value *businessData)
|
||||
JsAppAuthorizationExtensionParam **param, BusinessError &error, napi_value *businessData)
|
||||
{
|
||||
size_t argc = ARGC_TWO;
|
||||
napi_value argv[ARGC_TWO] = {nullptr};
|
||||
@ -55,7 +55,7 @@ static bool GetExtentionCallbackCommonParam(napi_env env, napi_callback_info cbI
|
||||
ACCOUNT_LOGE("the number of argument should be at least 1");
|
||||
return false;
|
||||
}
|
||||
*param = reinterpret_cast<JsAppAAuthenticationExtensionParam *>(data);
|
||||
*param = reinterpret_cast<JsAppAuthorizationExtensionParam *>(data);
|
||||
if ((*param == nullptr) || ((*param)->callback == nullptr)) {
|
||||
ACCOUNT_LOGE("native callback is nullptr");
|
||||
return false;
|
||||
@ -70,15 +70,15 @@ static bool GetExtentionCallbackCommonParam(napi_env env, napi_callback_info cbI
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool InitAuthenticationExtensionExecEnv(napi_env env, uv_loop_s **loop, uv_work_t **work,
|
||||
JsAppAAuthenticationExtensionParam **param, ThreadLockInfo *lockInfo)
|
||||
static bool InitAuthorizationExtensionExecEnv(napi_env env, uv_loop_s **loop, uv_work_t **work,
|
||||
JsAppAuthorizationExtensionParam **param, ThreadLockInfo *lockInfo)
|
||||
{
|
||||
if (!CreateExecEnv(env, loop, work)) {
|
||||
return false;
|
||||
}
|
||||
*param = new (std::nothrow) JsAppAAuthenticationExtensionParam(env);
|
||||
*param = new (std::nothrow) JsAppAuthorizationExtensionParam(env);
|
||||
if (*param == nullptr) {
|
||||
ACCOUNT_LOGE("failed to create JsAppAAuthenticationExtensionParam");
|
||||
ACCOUNT_LOGE("failed to create JsAppAuthorizationExtensionParam");
|
||||
delete *work;
|
||||
*work = nullptr;
|
||||
return false;
|
||||
@ -89,7 +89,7 @@ static bool InitAuthenticationExtensionExecEnv(napi_env env, uv_loop_s **loop, u
|
||||
}
|
||||
|
||||
static napi_value CreateExtensionAsyncCallback(
|
||||
napi_env env, napi_callback callback, JsAppAAuthenticationExtensionParam *param)
|
||||
napi_env env, napi_callback callback, JsAppAuthorizationExtensionParam *param)
|
||||
{
|
||||
napi_value napiCallback = nullptr;
|
||||
napi_status status = napi_create_function(env, "callback", NAPI_AUTO_LENGTH, callback, param, &napiCallback);
|
||||
@ -100,11 +100,11 @@ static napi_value CreateExtensionAsyncCallback(
|
||||
status = napi_wrap(
|
||||
env, napiCallback, param,
|
||||
[](napi_env env, void *data, void *hint) {
|
||||
delete reinterpret_cast<JsAppAAuthenticationExtensionParam *>(data);
|
||||
delete reinterpret_cast<JsAppAuthorizationExtensionParam *>(data);
|
||||
},
|
||||
nullptr, nullptr);
|
||||
if (status != napi_ok) {
|
||||
ACCOUNT_LOGE("failed to wrap callback with JsAppAAuthenticationExtensionParam");
|
||||
ACCOUNT_LOGE("failed to wrap callback with JsAppAuthorizationExtensionParam");
|
||||
return nullptr;
|
||||
}
|
||||
return napiCallback;
|
||||
@ -112,7 +112,7 @@ static napi_value CreateExtensionAsyncCallback(
|
||||
|
||||
static napi_value OnResultCallback(napi_env env, napi_callback_info cbInfo)
|
||||
{
|
||||
JsAppAAuthenticationExtensionParam *param = nullptr;
|
||||
JsAppAuthorizationExtensionParam *param = nullptr;
|
||||
BusinessError error;
|
||||
napi_value businessData = nullptr;
|
||||
if (!GetExtentionCallbackCommonParam(env, cbInfo, ¶m, error, &businessData)) {
|
||||
@ -133,12 +133,12 @@ static napi_value OnResultCallback(napi_env env, napi_callback_info cbInfo)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JsAppAAuthenticationExtensionParam::JsAppAAuthenticationExtensionParam(napi_env napiEnv)
|
||||
JsAppAuthorizationExtensionParam::JsAppAuthorizationExtensionParam(napi_env napiEnv)
|
||||
{
|
||||
env = napiEnv;
|
||||
}
|
||||
|
||||
static napi_value CreateNapiRequest(napi_env env, JsAppAAuthenticationExtensionParam *param)
|
||||
static napi_value CreateNapiRequest(napi_env env, JsAppAuthorizationExtensionParam *param)
|
||||
{
|
||||
napi_value napiRequest = nullptr;
|
||||
NAPI_CALL(env, napi_create_object(env, &napiRequest));
|
||||
@ -150,23 +150,23 @@ static napi_value CreateNapiRequest(napi_env env, JsAppAAuthenticationExtensionP
|
||||
return napiRequest;
|
||||
}
|
||||
|
||||
static napi_value CreateAuthenticationCallback(napi_env env, JsAppAAuthenticationExtensionParam *param)
|
||||
static napi_value CreateAuthorizationCallback(napi_env env, JsAppAuthorizationExtensionParam *param)
|
||||
{
|
||||
napi_value authenticationCallback = nullptr;
|
||||
NAPI_CALL(env, napi_create_object(env, &authenticationCallback));
|
||||
napi_value authorizationCallback = nullptr;
|
||||
NAPI_CALL(env, napi_create_object(env, &authorizationCallback));
|
||||
napi_value napiCallback = CreateExtensionAsyncCallback(env, OnResultCallback, param);
|
||||
NAPI_CALL(env, napi_set_named_property(env, authenticationCallback, "onResult", napiCallback));
|
||||
return authenticationCallback;
|
||||
NAPI_CALL(env, napi_set_named_property(env, authorizationCallback, "onResult", napiCallback));
|
||||
return authorizationCallback;
|
||||
}
|
||||
|
||||
JsAuthenticationExtension* JsAuthenticationExtension::Create(const std::unique_ptr<Runtime>& runtime)
|
||||
JsAuthorizationExtension* JsAuthorizationExtension::Create(const std::unique_ptr<Runtime>& runtime)
|
||||
{
|
||||
return new JsAuthenticationExtension(static_cast<JsRuntime&>(*runtime));
|
||||
return new JsAuthorizationExtension(static_cast<JsRuntime&>(*runtime));
|
||||
}
|
||||
|
||||
JsAuthenticationExtension::JsAuthenticationExtension(JsRuntime& jsRuntime) : jsRuntime_(jsRuntime) {}
|
||||
JsAuthorizationExtension::JsAuthorizationExtension(JsRuntime& jsRuntime) : jsRuntime_(jsRuntime) {}
|
||||
|
||||
JsAuthenticationExtension::~JsAuthenticationExtension()
|
||||
JsAuthorizationExtension::~JsAuthorizationExtension()
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(lockInfo_.mutex);
|
||||
lockInfo_.condition.wait(lock, [this] { return this->lockInfo_.count == 0; });
|
||||
@ -174,11 +174,11 @@ JsAuthenticationExtension::~JsAuthenticationExtension()
|
||||
jsRuntime_.FreeNativeReference(std::move(jsObj_));
|
||||
}
|
||||
|
||||
void JsAuthenticationExtension::Init(const std::shared_ptr<AbilityLocalRecord> &record,
|
||||
void JsAuthorizationExtension::Init(const std::shared_ptr<AbilityLocalRecord> &record,
|
||||
const std::shared_ptr<OHOSApplication> &application, std::shared_ptr<AbilityHandler> &handler,
|
||||
const sptr<IRemoteObject> &token)
|
||||
{
|
||||
AuthenticationExtension::Init(record, application, handler, token);
|
||||
AuthorizationExtension::Init(record, application, handler, token);
|
||||
std::string srcPath = "";
|
||||
GetSrcPath(srcPath);
|
||||
if (srcPath.empty()) {
|
||||
@ -198,12 +198,12 @@ void JsAuthenticationExtension::Init(const std::shared_ptr<AbilityLocalRecord> &
|
||||
}
|
||||
}
|
||||
|
||||
void JsAuthenticationExtension::OnStart(const AAFwk::Want &want)
|
||||
void JsAuthorizationExtension::OnStart(const AAFwk::Want &want)
|
||||
{
|
||||
Extension::OnStart(want);
|
||||
}
|
||||
|
||||
static void DeleteParamLocked(JsAppAAuthenticationExtensionParam *param, napi_handle_scope &scope)
|
||||
static void DeleteParamLocked(JsAppAuthorizationExtensionParam *param, napi_handle_scope &scope)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(param->lockInfo->mutex);
|
||||
param->lockInfo->count--;
|
||||
@ -212,37 +212,37 @@ static void DeleteParamLocked(JsAppAAuthenticationExtensionParam *param, napi_ha
|
||||
napi_close_handle_scope(param->env, scope);
|
||||
}
|
||||
|
||||
static void StartAuthenticationWork(uv_work_t *work, int status)
|
||||
static void StartAuthorizationWork(uv_work_t *work, int status)
|
||||
{
|
||||
std::unique_ptr<uv_work_t> workPtr(work);
|
||||
napi_handle_scope scope = nullptr;
|
||||
if (!InitUvWorkCallbackEnv(work, scope)) {
|
||||
return;
|
||||
}
|
||||
JsAppAAuthenticationExtensionParam *param = reinterpret_cast<JsAppAAuthenticationExtensionParam *>(work->data);
|
||||
if (param->authenticationExtension == nullptr) {
|
||||
JsAppAuthorizationExtensionParam *param = reinterpret_cast<JsAppAuthorizationExtensionParam *>(work->data);
|
||||
if (param->authorizationExtension == nullptr) {
|
||||
DeleteParamLocked(param, scope);
|
||||
return;
|
||||
}
|
||||
napi_value napiRequest = CreateNapiRequest(param->env, param);
|
||||
NativeValue *nativeRequest = reinterpret_cast<NativeValue *>(napiRequest);
|
||||
napi_value napiAuthenticationCallback = CreateAuthenticationCallback(param->env, param);
|
||||
if (napiAuthenticationCallback == nullptr) {
|
||||
napi_value napiAuthorizationCallback = CreateAuthorizationCallback(param->env, param);
|
||||
if (napiAuthorizationCallback == nullptr) {
|
||||
DeleteParamLocked(param, scope);
|
||||
return;
|
||||
}
|
||||
NativeValue *nativeAuthenticationCallback = reinterpret_cast<NativeValue *>(napiAuthenticationCallback);
|
||||
NativeValue *argv[] = {nativeRequest, nativeAuthenticationCallback};
|
||||
param->authenticationExtension->CallObjectMethod("onStartAuthorization", argv, ARGC_TWO);
|
||||
NativeValue *nativeAuthorizationCallback = reinterpret_cast<NativeValue *>(napiAuthorizationCallback);
|
||||
NativeValue *argv[] = {nativeRequest, nativeAuthorizationCallback};
|
||||
param->authorizationExtension->CallObjectMethod("onStartAuthorization", argv, ARGC_TWO);
|
||||
std::unique_lock<std::mutex> lock(param->lockInfo->mutex);
|
||||
param->lockInfo->count--;
|
||||
param->lockInfo->condition.notify_all();
|
||||
napi_close_handle_scope(param->env, scope);
|
||||
}
|
||||
|
||||
void JsAuthenticationExtension::StartAuthentication(const AccountSA::AuthenticationRequest &request,
|
||||
const std::shared_ptr<AccountSA::AppAccountAuthenticationExtensionCallbackClient> &callbackPtr,
|
||||
const std::shared_ptr<JsAuthenticationExtension> &extension)
|
||||
void JsAuthorizationExtension::StartAuthorization(const AccountSA::AuthorizationRequest &request,
|
||||
const std::shared_ptr<AccountSA::AppAccountAuthorizationExtensionCallbackClient> &callbackPtr,
|
||||
const std::shared_ptr<JsAuthorizationExtension> &extension)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(lockInfo_.mutex);
|
||||
if (lockInfo_.count < 0) {
|
||||
@ -251,19 +251,19 @@ void JsAuthenticationExtension::StartAuthentication(const AccountSA::Authenticat
|
||||
}
|
||||
uv_loop_s *loop = nullptr;
|
||||
uv_work_t *work = nullptr;
|
||||
JsAppAAuthenticationExtensionParam *param = nullptr;
|
||||
JsAppAuthorizationExtensionParam *param = nullptr;
|
||||
NativeEngine *nativeEngine = &jsRuntime_.GetNativeEngine();
|
||||
if (!InitAuthenticationExtensionExecEnv(
|
||||
if (!InitAuthorizationExtensionExecEnv(
|
||||
reinterpret_cast<napi_env>(nativeEngine), &loop, &work, ¶m, &lockInfo_)) {
|
||||
ACCOUNT_LOGE("failed to init authentication extension execution environment");
|
||||
ACCOUNT_LOGE("failed to init authorization extension execution environment");
|
||||
return;
|
||||
}
|
||||
param->request = request;
|
||||
param->callback = callbackPtr;
|
||||
param->authenticationExtension = extension;
|
||||
param->authorizationExtension = extension;
|
||||
|
||||
int errCode = uv_queue_work(
|
||||
loop, work, [](uv_work_t *work) {}, StartAuthenticationWork);
|
||||
loop, work, [](uv_work_t *work) {}, StartAuthorizationWork);
|
||||
if (errCode != 0) {
|
||||
ACCOUNT_LOGE("failed to uv_queue_work, errCode: %{public}d", errCode);
|
||||
delete work;
|
||||
@ -273,7 +273,7 @@ void JsAuthenticationExtension::StartAuthentication(const AccountSA::Authenticat
|
||||
lockInfo_.count++;
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> JsAuthenticationExtension::OnConnect(const OHOS::AAFwk::Want& want)
|
||||
sptr<IRemoteObject> JsAuthorizationExtension::OnConnect(const OHOS::AAFwk::Want& want)
|
||||
{
|
||||
ErrCode errCode = AccountPermissionManager::CheckSystemApp();
|
||||
if (errCode != ERR_OK) {
|
||||
@ -282,10 +282,10 @@ sptr<IRemoteObject> JsAuthenticationExtension::OnConnect(const OHOS::AAFwk::Want
|
||||
}
|
||||
Extension::OnConnect(want);
|
||||
if (providerRemoteObject_ == nullptr) {
|
||||
std::shared_ptr<JsAuthenticationExtension> authenticationExtension =
|
||||
std::static_pointer_cast<JsAuthenticationExtension>(shared_from_this());
|
||||
sptr<AppAccountAuthenticationExtensionService> providerService =
|
||||
new (std::nothrow) AppAccountAuthenticationExtensionService(authenticationExtension);
|
||||
std::shared_ptr<JsAuthorizationExtension> authorizationExtension =
|
||||
std::static_pointer_cast<JsAuthorizationExtension>(shared_from_this());
|
||||
sptr<AppAccountAuthorizationExtensionService> providerService =
|
||||
new (std::nothrow) AppAccountAuthorizationExtensionService(authorizationExtension);
|
||||
if (providerService == nullptr) {
|
||||
ACCOUNT_LOGE("providerService is nullptr");
|
||||
return nullptr;
|
||||
@ -295,10 +295,10 @@ sptr<IRemoteObject> JsAuthenticationExtension::OnConnect(const OHOS::AAFwk::Want
|
||||
return providerRemoteObject_;
|
||||
}
|
||||
|
||||
NativeValue *JsAuthenticationExtension::CallObjectMethod(const std::string &name, NativeValue *const *argv, size_t argc)
|
||||
NativeValue *JsAuthorizationExtension::CallObjectMethod(const std::string &name, NativeValue *const *argv, size_t argc)
|
||||
{
|
||||
if (!jsObj_) {
|
||||
ACCOUNT_LOGE("not found AuthenticationExtension.js");
|
||||
ACCOUNT_LOGE("not found AuthorizationExtension.js");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -308,19 +308,19 @@ NativeValue *JsAuthenticationExtension::CallObjectMethod(const std::string &name
|
||||
NativeValue *value = jsObj_->Get();
|
||||
NativeObject *obj = ConvertNativeValueTo<NativeObject>(value);
|
||||
if (obj == nullptr) {
|
||||
ACCOUNT_LOGE("Failed to get AuthenticationExtension object");
|
||||
ACCOUNT_LOGE("Failed to get AuthorizationExtension object");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NativeValue *method = obj->GetProperty(name.c_str());
|
||||
if ((method == nullptr) || (method->TypeOf() != NATIVE_FUNCTION)) {
|
||||
ACCOUNT_LOGE("Failed to get '%{public}s' from AuthenticationExtension object", name.c_str());
|
||||
ACCOUNT_LOGE("Failed to get '%{public}s' from AuthorizationExtension object", name.c_str());
|
||||
return nullptr;
|
||||
}
|
||||
return nativeEngine.CallFunction(value, method, argv, argc);
|
||||
}
|
||||
|
||||
void JsAuthenticationExtension::GetSrcPath(std::string &srcPath)
|
||||
void JsAuthorizationExtension::GetSrcPath(std::string &srcPath)
|
||||
{
|
||||
if (!Extension::abilityInfo_->isModuleJson) {
|
||||
/* temporary compatibility api8 + config.json */
|
@ -141,10 +141,10 @@ ohos_shared_library("accountmgr") {
|
||||
}
|
||||
|
||||
sources = [
|
||||
"${app_account_innerkits_native_path}/src/app_account_authentication_extension_callback_proxy.cpp",
|
||||
"${app_account_innerkits_native_path}/src/app_account_authentication_extension_callback_stub.cpp",
|
||||
"${app_account_innerkits_native_path}/src/app_account_authenticator_callback_proxy.cpp",
|
||||
"${app_account_innerkits_native_path}/src/app_account_authenticator_callback_stub.cpp",
|
||||
"${app_account_innerkits_native_path}/src/app_account_authorization_extension_callback_proxy.cpp",
|
||||
"${app_account_innerkits_native_path}/src/app_account_authorization_extension_callback_stub.cpp",
|
||||
"${app_account_innerkits_native_path}/src/app_account_common.cpp",
|
||||
"${app_account_innerkits_native_path}/src/app_account_info.cpp",
|
||||
"${app_account_innerkits_native_path}/src/app_account_subscribe_info.cpp",
|
||||
@ -169,12 +169,12 @@ ohos_shared_library("accountmgr") {
|
||||
"src/account_state_machine.cpp",
|
||||
"src/account_stub.cpp",
|
||||
"src/appaccount/app_account_app_state_observer.cpp",
|
||||
"src/appaccount/app_account_authentication_extension_proxy.cpp",
|
||||
"src/appaccount/app_account_authenticator_callback.cpp",
|
||||
"src/appaccount/app_account_authenticator_manager.cpp",
|
||||
"src/appaccount/app_account_authenticator_proxy.cpp",
|
||||
"src/appaccount/app_account_authenticator_session.cpp",
|
||||
"src/appaccount/app_account_authenticator_session_manager.cpp",
|
||||
"src/appaccount/app_account_authorization_extension_proxy.cpp",
|
||||
"src/appaccount/app_account_check_labels_callback.cpp",
|
||||
"src/appaccount/app_account_check_labels_session.cpp",
|
||||
"src/appaccount/app_account_common_event_observer.cpp",
|
||||
|
@ -13,29 +13,29 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APP_ACCOUNT_AUTHENTICATION_EXTENSION_PROXY_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APP_ACCOUNT_AUTHENTICATION_EXTENSION_PROXY_H
|
||||
#ifndef OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APP_ACCOUNT_AUTHORIZATION_EXTENSION_PROXY_H
|
||||
#define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APP_ACCOUNT_AUTHORIZATION_EXTENSION_PROXY_H
|
||||
|
||||
#include <string>
|
||||
#include "account_error_no.h"
|
||||
#include "iapp_account_authentication_extension.h"
|
||||
#include "iapp_account_authorization_extension.h"
|
||||
#include "iremote_proxy.h"
|
||||
#include "want.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class AppAccountAuthenticationExtensionProxy : public IRemoteProxy<IAppAccountAuthenticationExtension> {
|
||||
class AppAccountAuthorizationExtensionProxy : public IRemoteProxy<IAppAccountAuthorizationExtension> {
|
||||
public:
|
||||
explicit AppAccountAuthenticationExtensionProxy(const sptr<IRemoteObject> &object);
|
||||
~AppAccountAuthenticationExtensionProxy() override;
|
||||
ErrCode StartAuthentication(const AuthenticationRequest &request) override;
|
||||
explicit AppAccountAuthorizationExtensionProxy(const sptr<IRemoteObject> &object);
|
||||
~AppAccountAuthorizationExtensionProxy() override;
|
||||
ErrCode StartAuthorization(const AuthorizationRequest &request) override;
|
||||
|
||||
private:
|
||||
ErrCode SendRequest(IAppAccountAuthenticationExtension::Message code, MessageParcel &data, MessageParcel &reply);
|
||||
ErrCode SendRequest(IAppAccountAuthorizationExtension::Message code, MessageParcel &data, MessageParcel &reply);
|
||||
|
||||
private:
|
||||
static inline BrokerDelegator<AppAccountAuthenticationExtensionProxy> delegator_;
|
||||
static inline BrokerDelegator<AppAccountAuthorizationExtensionProxy> delegator_;
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APP_ACCOUNT_AUTHENTICATION_EXTENSION_PROXY_H
|
||||
#endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APP_ACCOUNT_AUTHORIZATION_EXTENSION_PROXY_H
|
@ -103,7 +103,7 @@ public:
|
||||
ErrCode OnUserRemoved(int32_t userId);
|
||||
|
||||
ErrCode ExecuteRequest(
|
||||
AuthenticationRequest &request, const std::string &bundleName, const std::string &abilityName);
|
||||
AuthorizationRequest &request, const std::string &bundleName, const std::string &abilityName);
|
||||
private:
|
||||
AppAccountControlManager &controlManager_;
|
||||
AppAccountSubscribeManager &subscribeManager_;
|
||||
@ -114,7 +114,7 @@ private:
|
||||
|
||||
class RequestConnection : public AAFwk::AbilityConnectionStub {
|
||||
public:
|
||||
RequestConnection(const int32_t &uid, const AuthenticationRequest &request);
|
||||
RequestConnection(const int32_t &uid, const AuthorizationRequest &request);
|
||||
~RequestConnection() override;
|
||||
|
||||
void OnAbilityConnectDone(
|
||||
@ -123,7 +123,7 @@ public:
|
||||
|
||||
private:
|
||||
int32_t uid_;
|
||||
AuthenticationRequest request_;
|
||||
AuthorizationRequest request_;
|
||||
};
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
||||
|
@ -172,7 +172,7 @@
|
||||
"OHOS::AccountSA::InnerAppAccountManager::UnsubscribeAppAccount(OHOS::sptr<OHOS::IRemoteObject> const&)";
|
||||
"OHOS::AccountSA::InnerAppAccountManager::VerifyCredential(OHOS::AccountSA::AuthenticatorSessionRequest const&)";
|
||||
"OHOS::AccountSA::InnerAppAccountManager::~InnerAppAccountManager()";
|
||||
"OHOS::AccountSA::InnerAppAccountManager::ExecuteRequest(OHOS::AccountSA::AuthenticationRequest&, std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>> const&, std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>> const&)";
|
||||
"OHOS::AccountSA::InnerAppAccountManager::ExecuteRequest(OHOS::AccountSA::AuthorizationRequest&, std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>> const&, std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>> const&)";
|
||||
"OHOS::AccountSA::OhosAccountManager::GetAccountInfoByUserId(int, OHOS::AccountSA::AccountInfo&)";
|
||||
"OHOS::AccountSA::OhosAccountManager::GetCurrentOhosAccountState()";
|
||||
"OHOS::AccountSA::OhosAccountManager::HandleEvent(OHOS::AccountSA::AccountInfo&, std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>> const&)";
|
||||
|
@ -13,22 +13,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "app_account_authentication_extension_proxy.h"
|
||||
#include "app_account_authorization_extension_proxy.h"
|
||||
|
||||
#include "account_error_no.h"
|
||||
#include "account_log_wrapper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
AppAccountAuthenticationExtensionProxy::AppAccountAuthenticationExtensionProxy(const sptr<IRemoteObject> &object)
|
||||
: IRemoteProxy<IAppAccountAuthenticationExtension>(object)
|
||||
AppAccountAuthorizationExtensionProxy::AppAccountAuthorizationExtensionProxy(const sptr<IRemoteObject> &object)
|
||||
: IRemoteProxy<IAppAccountAuthorizationExtension>(object)
|
||||
{}
|
||||
|
||||
AppAccountAuthenticationExtensionProxy::~AppAccountAuthenticationExtensionProxy()
|
||||
AppAccountAuthorizationExtensionProxy::~AppAccountAuthorizationExtensionProxy()
|
||||
{}
|
||||
|
||||
ErrCode AppAccountAuthenticationExtensionProxy::SendRequest(
|
||||
IAppAccountAuthenticationExtension::Message code, MessageParcel &data, MessageParcel &reply)
|
||||
ErrCode AppAccountAuthorizationExtensionProxy::SendRequest(
|
||||
IAppAccountAuthorizationExtension::Message code, MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
@ -48,7 +48,7 @@ ErrCode AppAccountAuthenticationExtensionProxy::SendRequest(
|
||||
return result;
|
||||
}
|
||||
|
||||
static ErrCode WriteRequest(MessageParcel &data, const AuthenticationRequest &request)
|
||||
static ErrCode WriteRequest(MessageParcel &data, const AuthorizationRequest &request)
|
||||
{
|
||||
if (!data.WriteInt32(request.callerUid)) {
|
||||
ACCOUNT_LOGE("failed to write request callerUid");
|
||||
@ -65,7 +65,7 @@ static ErrCode WriteRequest(MessageParcel &data, const AuthenticationRequest &re
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AppAccountAuthenticationExtensionProxy::StartAuthentication(const AuthenticationRequest &request)
|
||||
ErrCode AppAccountAuthorizationExtensionProxy::StartAuthorization(const AuthorizationRequest &request)
|
||||
{
|
||||
MessageParcel data;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
@ -78,7 +78,7 @@ ErrCode AppAccountAuthenticationExtensionProxy::StartAuthentication(const Authen
|
||||
}
|
||||
MessageParcel reply;
|
||||
return SendRequest(
|
||||
IAppAccountAuthenticationExtension::Message::APP_AUTHENTICATE_EXTENSION_START_AUTHENTICATION, data, reply);
|
||||
IAppAccountAuthorizationExtension::Message::APP_AUTHORIZATION_EXTENSION_START_AUTHENTICATION, data, reply);
|
||||
}
|
||||
} // namespace AccountSA
|
||||
} // namespace OHOS
|
@ -703,7 +703,7 @@ ErrCode AppAccountManagerService::SetAuthenticatorProperties(
|
||||
ErrCode AppAccountManagerService::ExecuteRequest(
|
||||
const AccountCapabilityRequest &request, const sptr<IRemoteObject> &callback)
|
||||
{
|
||||
AuthenticationRequest innerRequest;
|
||||
AuthorizationRequest innerRequest;
|
||||
std::string callerBundleName;
|
||||
uint32_t appIndex;
|
||||
ErrCode result = GetCallingInfo(innerRequest.callerUid, callerBundleName, appIndex);
|
||||
@ -712,7 +712,7 @@ ErrCode AppAccountManagerService::ExecuteRequest(
|
||||
}
|
||||
|
||||
innerRequest.parameters = request.parameters;
|
||||
innerRequest.callback = iface_cast<IAppAccountAuthenticationExtensionCallback>(callback);
|
||||
innerRequest.callback = iface_cast<IAppAccountAuthorizationExtensionCallback>(callback);
|
||||
if (innerRequest.callback == nullptr) {
|
||||
return ERR_JS_SYSTEM_SERVICE_EXCEPTION;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "app_account_authenticator_session.h"
|
||||
#include "app_account_control_manager.h"
|
||||
#include "app_account_subscribe_manager.h"
|
||||
#include "app_account_authentication_extension_stub.h"
|
||||
#include "app_account_authorization_extension_stub.h"
|
||||
#include "bundle_manager_adapter.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -228,7 +228,7 @@ ErrCode InnerAppAccountManager::Authenticate(const AuthenticatorSessionRequest &
|
||||
return sessionManager_.Authenticate(request);
|
||||
}
|
||||
|
||||
RequestConnection::RequestConnection(const int32_t &uid, const AuthenticationRequest &request)
|
||||
RequestConnection::RequestConnection(const int32_t &uid, const AuthorizationRequest &request)
|
||||
:uid_(uid), request_(request)
|
||||
{}
|
||||
|
||||
@ -239,14 +239,14 @@ void RequestConnection::OnAbilityConnectDone(
|
||||
const AppExecFwk::ElementName &element, const sptr<IRemoteObject> &remoteObject, int32_t resultCode)
|
||||
{
|
||||
AAFwk::WantParams errResult;
|
||||
sptr<IAppAccountAuthenticationExtension>
|
||||
authenticationProxy_ = iface_cast<IAppAccountAuthenticationExtension>(remoteObject);
|
||||
sptr<IAppAccountAuthorizationExtension>
|
||||
authenticationProxy_ = iface_cast<IAppAccountAuthorizationExtension>(remoteObject);
|
||||
if ((!authenticationProxy_) || (!authenticationProxy_->AsObject())) {
|
||||
ACCOUNT_LOGE("failed to cast app account authenticator proxy, callerUid = %{public}d", uid_);
|
||||
request_.callback->OnResult(ERR_JS_SYSTEM_SERVICE_EXCEPTION, errResult);
|
||||
return;
|
||||
}
|
||||
resultCode = authenticationProxy_->StartAuthentication(request_);
|
||||
resultCode = authenticationProxy_->StartAuthorization(request_);
|
||||
if (resultCode != ERR_OK) {
|
||||
request_.callback->OnResult(ERR_JS_SYSTEM_SERVICE_EXCEPTION, errResult);
|
||||
}
|
||||
@ -302,7 +302,7 @@ static bool QueryAbilityInfo(const std::string &bundleName, const std::string &a
|
||||
}
|
||||
|
||||
ErrCode InnerAppAccountManager::ExecuteRequest(
|
||||
AuthenticationRequest &request, const std::string &bundleName, const std::string &abilityName)
|
||||
AuthorizationRequest &request, const std::string &bundleName, const std::string &abilityName)
|
||||
{
|
||||
AAFwk::WantParams Params;
|
||||
AppExecFwk::ExtensionAbilityInfo extensionInfo;
|
||||
|
@ -80,8 +80,8 @@ ohos_moduletest("app_account_authorization_extension_ability_test") {
|
||||
"${app_account_services_path}/include",
|
||||
]
|
||||
sources = [
|
||||
"${app_account_kits_path}/src/napi_app_account_authentication_extension.cpp",
|
||||
"${app_account_services_path}/src/appaccount/app_account_authentication_extension_proxy.cpp",
|
||||
"${app_account_kits_path}/src/napi_app_account_authorization_extension.cpp",
|
||||
"${app_account_services_path}/src/appaccount/app_account_authorization_extension_proxy.cpp",
|
||||
"app_account_authorization_extension_ability_test.cpp",
|
||||
]
|
||||
|
||||
@ -89,7 +89,7 @@ ohos_moduletest("app_account_authorization_extension_ability_test") {
|
||||
|
||||
deps = [
|
||||
"${account_napi_common_path}:account_napi_common",
|
||||
"${app_account_extension_path}:authentication_extension",
|
||||
"${app_account_extension_path}:authorization_extension",
|
||||
"${app_account_innerkits_native_path}:app_account_innerkits",
|
||||
"${app_account_services_path}:accountmgr",
|
||||
"${common_path}:libaccount_common",
|
||||
|
@ -17,14 +17,14 @@
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
#include "account_log_wrapper.h"
|
||||
#include "app_account_authentication_extension_callback.h"
|
||||
#include "app_account_authentication_extension_callback_service.h"
|
||||
#include "app_account_authentication_extension_proxy.h"
|
||||
#include "app_account_authentication_extension_service.h"
|
||||
#include "app_account_authentication_extension_stub.h"
|
||||
#include "app_account_authorization_extension_callback.h"
|
||||
#include "app_account_authorization_extension_callback_service.h"
|
||||
#include "app_account_authorization_extension_proxy.h"
|
||||
#include "app_account_authorization_extension_service.h"
|
||||
#include "app_account_authorization_extension_stub.h"
|
||||
#include "app_account_common.h"
|
||||
#include "authentication_extension.h"
|
||||
#include "napi_app_account_authentication_extension.h"
|
||||
#include "authorization_extension.h"
|
||||
#include "napi_app_account_authorization_extension.h"
|
||||
#include "js_runtime.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
@ -32,37 +32,37 @@ using namespace testing;
|
||||
using namespace OHOS;
|
||||
using namespace OHOS::AccountSA;
|
||||
|
||||
class MockAppAccountAuthenticationExtensionCallback {
|
||||
class MockAppAccountAuthorizationExtensionCallback {
|
||||
public:
|
||||
MOCK_METHOD2(OnResult, void(const int32_t errCode, const AAFwk::WantParams ¶meters));
|
||||
};
|
||||
|
||||
class TestAppAccountAuthenticationExtensionCallback : public AppAccountAuthenticationExtensionCallback {
|
||||
class TestAppAccountAuthorizationExtensionCallback : public AppAccountAuthorizationExtensionCallback {
|
||||
public:
|
||||
explicit TestAppAccountAuthenticationExtensionCallback(
|
||||
const std::shared_ptr<MockAppAccountAuthenticationExtensionCallback> &callback)
|
||||
explicit TestAppAccountAuthorizationExtensionCallback(
|
||||
const std::shared_ptr<MockAppAccountAuthorizationExtensionCallback> &callback)
|
||||
{
|
||||
callback_ = callback;
|
||||
}
|
||||
virtual ~TestAppAccountAuthenticationExtensionCallback();
|
||||
virtual ~TestAppAccountAuthorizationExtensionCallback();
|
||||
void OnResult(const int32_t errCode, const AAFwk::WantParams ¶meters) override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<MockAppAccountAuthenticationExtensionCallback> callback_;
|
||||
std::shared_ptr<MockAppAccountAuthorizationExtensionCallback> callback_;
|
||||
};
|
||||
|
||||
TestAppAccountAuthenticationExtensionCallback::~TestAppAccountAuthenticationExtensionCallback()
|
||||
TestAppAccountAuthorizationExtensionCallback::~TestAppAccountAuthorizationExtensionCallback()
|
||||
{}
|
||||
|
||||
void TestAppAccountAuthenticationExtensionCallback::OnResult(const int32_t errCode, const AAFwk::WantParams ¶meters)
|
||||
void TestAppAccountAuthorizationExtensionCallback::OnResult(const int32_t errCode, const AAFwk::WantParams ¶meters)
|
||||
{
|
||||
callback_->OnResult(errCode, parameters);
|
||||
}
|
||||
|
||||
class MockJsAuthenticationExtension final : public OHOS::AbilityRuntime::AuthenticationExtension {
|
||||
class MockJsAuthorizationExtension final : public OHOS::AbilityRuntime::AuthorizationExtension {
|
||||
public:
|
||||
void StartAuthentication(
|
||||
const std::shared_ptr<AccountSA::AppAccountAuthenticationExtensionCallbackClient> &callbackPtr)
|
||||
void StartAuthorization(
|
||||
const std::shared_ptr<AccountSA::AppAccountAuthorizationExtensionCallbackClient> &callbackPtr)
|
||||
{
|
||||
AAFwk::WantParams parameters;
|
||||
EXPECT_NE(callbackPtr, nullptr);
|
||||
@ -71,30 +71,30 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class MockAppAccountAuthenticationExtensionService final : public AppAccountAuthenticationExtensionStub {
|
||||
class MockAppAccountAuthorizationExtensionService final : public AppAccountAuthorizationExtensionStub {
|
||||
public:
|
||||
explicit MockAppAccountAuthenticationExtensionService(
|
||||
const std::shared_ptr<MockJsAuthenticationExtension> &extension)
|
||||
explicit MockAppAccountAuthorizationExtensionService(
|
||||
const std::shared_ptr<MockJsAuthorizationExtension> &extension)
|
||||
: innerExtension_(extension)
|
||||
{}
|
||||
ErrCode StartAuthentication(const AuthenticationRequest &request)
|
||||
ErrCode StartAuthorization(const AuthorizationRequest &request)
|
||||
{
|
||||
AppAccountAuthenticationExtensionCallbackClient *callbackClient =
|
||||
new (std::nothrow) AppAccountAuthenticationExtensionCallbackClient(request.callback);
|
||||
AppAccountAuthorizationExtensionCallbackClient *callbackClient =
|
||||
new (std::nothrow) AppAccountAuthorizationExtensionCallbackClient(request.callback);
|
||||
EXPECT_NE(callbackClient, nullptr);
|
||||
std::shared_ptr<AppAccountAuthenticationExtensionCallbackClient> callbackPtr(callbackClient);
|
||||
innerExtension_->StartAuthentication(callbackPtr);
|
||||
std::shared_ptr<AppAccountAuthorizationExtensionCallbackClient> callbackPtr(callbackClient);
|
||||
innerExtension_->StartAuthorization(callbackPtr);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<MockJsAuthenticationExtension> innerExtension_ = nullptr;
|
||||
std::shared_ptr<MockJsAuthorizationExtension> innerExtension_ = nullptr;
|
||||
};
|
||||
|
||||
void InitRequestCallback(
|
||||
const std::shared_ptr<TestAppAccountAuthenticationExtensionCallback> &callback, AuthenticationRequest &request)
|
||||
const std::shared_ptr<TestAppAccountAuthorizationExtensionCallback> &callback, AuthorizationRequest &request)
|
||||
{
|
||||
request.callback = new (std::nothrow) AppAccountAuthenticationExtensionCallbackService(callback);
|
||||
request.callback = new (std::nothrow) AppAccountAuthorizationExtensionCallbackService(callback);
|
||||
EXPECT_NE(request.callback, nullptr);
|
||||
}
|
||||
|
||||
@ -121,82 +121,82 @@ void AppAccountExtensionModuleTest::TearDown(void)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @tc.name: StartAuthentication_0100
|
||||
* @tc.desc: test AppAccountAuthenticationExtensionProxy func StartAuthentication.
|
||||
* @tc.name: StartAuthorization_0100
|
||||
* @tc.desc: test AppAccountAuthorizationExtensionProxy func StartAuthorization.
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issuesI7AVZ5
|
||||
*/
|
||||
HWTEST_F(AppAccountExtensionModuleTest, StartAuthentication_0100, TestSize.Level1)
|
||||
HWTEST_F(AppAccountExtensionModuleTest, StartAuthorization_0100, TestSize.Level1)
|
||||
{
|
||||
std::shared_ptr<MockJsAuthenticationExtension> innerExtension = std::make_shared<MockJsAuthenticationExtension>();
|
||||
std::shared_ptr<MockJsAuthorizationExtension> innerExtension = std::make_shared<MockJsAuthorizationExtension>();
|
||||
EXPECT_NE(innerExtension, nullptr);
|
||||
sptr<MockAppAccountAuthenticationExtensionService> authenticationService =
|
||||
new (std::nothrow) MockAppAccountAuthenticationExtensionService(innerExtension);
|
||||
EXPECT_NE(authenticationService, nullptr);
|
||||
sptr<AppAccountAuthenticationExtensionProxy> authenticationProxy =
|
||||
new (std::nothrow) AppAccountAuthenticationExtensionProxy(authenticationService->AsObject());
|
||||
auto callback = std::make_shared<MockAppAccountAuthenticationExtensionCallback>();
|
||||
auto testCallbackCreate = std::make_shared<TestAppAccountAuthenticationExtensionCallback>(callback);
|
||||
sptr<MockAppAccountAuthorizationExtensionService> authorizationService =
|
||||
new (std::nothrow) MockAppAccountAuthorizationExtensionService(innerExtension);
|
||||
EXPECT_NE(authorizationService, nullptr);
|
||||
sptr<AppAccountAuthorizationExtensionProxy> authorizationProxy =
|
||||
new (std::nothrow) AppAccountAuthorizationExtensionProxy(authorizationService->AsObject());
|
||||
auto callback = std::make_shared<MockAppAccountAuthorizationExtensionCallback>();
|
||||
auto testCallbackCreate = std::make_shared<TestAppAccountAuthorizationExtensionCallback>(callback);
|
||||
EXPECT_CALL(*callback, OnResult(0, _)).Times(Exactly(1));
|
||||
AuthenticationRequest request;
|
||||
AuthorizationRequest request;
|
||||
InitRequestCallback(testCallbackCreate, request);
|
||||
EXPECT_NE(authenticationProxy, nullptr);
|
||||
EXPECT_EQ(authenticationProxy->StartAuthentication(request), ERR_OK);
|
||||
EXPECT_NE(authorizationProxy, nullptr);
|
||||
EXPECT_EQ(authorizationProxy->StartAuthorization(request), ERR_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: StartAuthentication_0200
|
||||
* @tc.desc: test AppAccountAuthenticationExtensionService func StartAuthentication.
|
||||
* @tc.name: StartAuthorization_0200
|
||||
* @tc.desc: test AppAccountAuthorizationExtensionService func StartAuthorization.
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issuesI7AVZ5
|
||||
*/
|
||||
HWTEST_F(AppAccountExtensionModuleTest, StartAuthentication_0200, TestSize.Level1)
|
||||
HWTEST_F(AppAccountExtensionModuleTest, StartAuthorization_0200, TestSize.Level1)
|
||||
{
|
||||
OHOS::AbilityRuntime::JsRuntime jsRuntime;
|
||||
std::shared_ptr<AccountJsKit::JsAuthenticationExtension> innerExtension =
|
||||
std::make_shared<OHOS::AccountJsKit::JsAuthenticationExtension>(jsRuntime);
|
||||
std::shared_ptr<AccountJsKit::JsAuthorizationExtension> innerExtension =
|
||||
std::make_shared<OHOS::AccountJsKit::JsAuthorizationExtension>(jsRuntime);
|
||||
EXPECT_NE(innerExtension, nullptr);
|
||||
sptr<AppAccountAuthenticationExtensionService> authenticationService =
|
||||
new (std::nothrow) AppAccountAuthenticationExtensionService(innerExtension);
|
||||
EXPECT_NE(authenticationService, nullptr);
|
||||
AuthenticationRequest request;
|
||||
EXPECT_EQ(authenticationService->StartAuthentication(request), ERR_OK);
|
||||
sptr<AppAccountAuthorizationExtensionService> authorizationService =
|
||||
new (std::nothrow) AppAccountAuthorizationExtensionService(innerExtension);
|
||||
EXPECT_NE(authorizationService, nullptr);
|
||||
AuthorizationRequest request;
|
||||
EXPECT_EQ(authorizationService->StartAuthorization(request), ERR_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: StartAuthentication_0300
|
||||
* @tc.desc: test AppAccountAuthenticationExtensionService func StartAuthentication with extension is nullptr.
|
||||
* @tc.name: StartAuthorization_0300
|
||||
* @tc.desc: test AppAccountAuthorizationExtensionService func StartAuthorization with extension is nullptr.
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issuesI7AVZ5
|
||||
*/
|
||||
HWTEST_F(AppAccountExtensionModuleTest, StartAuthentication_0300, TestSize.Level1)
|
||||
HWTEST_F(AppAccountExtensionModuleTest, StartAuthorization_0300, TestSize.Level1)
|
||||
{
|
||||
std::shared_ptr<AccountJsKit::JsAuthenticationExtension> innerExtension = nullptr;
|
||||
sptr<AppAccountAuthenticationExtensionService> authenticationService =
|
||||
new (std::nothrow) AppAccountAuthenticationExtensionService(innerExtension);
|
||||
EXPECT_NE(authenticationService, nullptr);
|
||||
AuthenticationRequest request;
|
||||
EXPECT_EQ(authenticationService->StartAuthentication(request), ERR_ACCOUNT_COMMON_NULL_PTR_ERROR);
|
||||
std::shared_ptr<AccountJsKit::JsAuthorizationExtension> innerExtension = nullptr;
|
||||
sptr<AppAccountAuthorizationExtensionService> authorizationService =
|
||||
new (std::nothrow) AppAccountAuthorizationExtensionService(innerExtension);
|
||||
EXPECT_NE(authorizationService, nullptr);
|
||||
AuthorizationRequest request;
|
||||
EXPECT_EQ(authorizationService->StartAuthorization(request), ERR_ACCOUNT_COMMON_NULL_PTR_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: StartAuthentication_0400
|
||||
* @tc.desc: test AppAccountAuthenticationExtensionProxy func StartAuthentication with callback is nullptr.
|
||||
* @tc.name: StartAuthorization_0400
|
||||
* @tc.desc: test AppAccountAuthorizationExtensionProxy func StartAuthorization with callback is nullptr.
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issuesI7AVZ5
|
||||
*/
|
||||
HWTEST_F(AppAccountExtensionModuleTest, StartAuthentication_0400, TestSize.Level1)
|
||||
HWTEST_F(AppAccountExtensionModuleTest, StartAuthorization_0400, TestSize.Level1)
|
||||
{
|
||||
std::shared_ptr<MockJsAuthenticationExtension> innerExtension = std::make_shared<MockJsAuthenticationExtension>();
|
||||
std::shared_ptr<MockJsAuthorizationExtension> innerExtension = std::make_shared<MockJsAuthorizationExtension>();
|
||||
EXPECT_NE(innerExtension, nullptr);
|
||||
sptr<MockAppAccountAuthenticationExtensionService> authenticationService =
|
||||
new (std::nothrow) MockAppAccountAuthenticationExtensionService(innerExtension);
|
||||
EXPECT_NE(authenticationService, nullptr);
|
||||
auto callback = std::make_shared<MockAppAccountAuthenticationExtensionCallback>();
|
||||
auto testCallbackCreate = std::make_shared<TestAppAccountAuthenticationExtensionCallback>(callback);
|
||||
sptr<AppAccountAuthenticationExtensionProxy> authenticationProxy =
|
||||
new (std::nothrow) AppAccountAuthenticationExtensionProxy(authenticationService->AsObject());
|
||||
EXPECT_NE(authenticationProxy, nullptr);
|
||||
AuthenticationRequest request;
|
||||
EXPECT_EQ(authenticationProxy->StartAuthentication(request), ERR_ACCOUNT_COMMON_WRITE_PARCEL_ERROR);
|
||||
sptr<MockAppAccountAuthorizationExtensionService> authorizationService =
|
||||
new (std::nothrow) MockAppAccountAuthorizationExtensionService(innerExtension);
|
||||
EXPECT_NE(authorizationService, nullptr);
|
||||
auto callback = std::make_shared<MockAppAccountAuthorizationExtensionCallback>();
|
||||
auto testCallbackCreate = std::make_shared<TestAppAccountAuthorizationExtensionCallback>(callback);
|
||||
sptr<AppAccountAuthorizationExtensionProxy> authorizationProxy =
|
||||
new (std::nothrow) AppAccountAuthorizationExtensionProxy(authorizationService->AsObject());
|
||||
EXPECT_NE(authorizationProxy, nullptr);
|
||||
AuthorizationRequest request;
|
||||
EXPECT_EQ(authorizationProxy->StartAuthorization(request), ERR_ACCOUNT_COMMON_WRITE_PARCEL_ERROR);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user