Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
5227bc04
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
接近 2 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5227bc04
编写于
7月 23, 2022
作者:
1
15829070344
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【OpenHar-3.2-Beta2】【账号】新增接口用例覆盖
Signed-off-by:
N
15829070344
<
hehaitao5@huawei.com
>
上级
bd3e2178
变更
22
展开全部
隐藏空白更改
内联
并排
Showing
22 changed file
with
1263 addition
and
885 deletion
+1263
-885
account/appaccount/BUILD.gn
account/appaccount/BUILD.gn
+1
-0
account/appaccount/actsaccountpressure/Test.json
account/appaccount/actsaccountpressure/Test.json
+0
-19
account/appaccount/actsaccountpressure/entry/src/main/js/default/pages/index/index.css
...tpressure/entry/src/main/js/default/pages/index/index.css
+0
-9
account/appaccount/actsaccountpressure/entry/src/main/js/resources/base/element/string.json
...sure/entry/src/main/js/resources/base/element/string.json
+0
-12
account/appaccount/actsaccountpressure/entry/src/main/js/test/Pressure.test.js
...tsaccountpressure/entry/src/main/js/test/Pressure.test.js
+0
-786
account/appaccount/actsaccounttest/Test.json
account/appaccount/actsaccounttest/Test.json
+2
-1
account/appaccount/actsaccounttest/entry/src/main/js/test/Authenticator.test.js
...saccounttest/entry/src/main/js/test/Authenticator.test.js
+636
-0
account/appaccount/actsaccounttest/entry/src/main/js/test/List.test.js
...count/actsaccounttest/entry/src/main/js/test/List.test.js
+2
-1
account/appaccount/sceneProject/BUILD.gn
account/appaccount/sceneProject/BUILD.gn
+1
-0
account/appaccount/sceneProject/actsaccountauthenticator/BUILD.gn
...appaccount/sceneProject/actsaccountauthenticator/BUILD.gn
+12
-5
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/config.json
...oject/actsaccountauthenticator/entry/src/main/config.json
+80
-0
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/Common/utils.js
...ctsaccountauthenticator/entry/src/main/js/Common/utils.js
+359
-0
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/app.js
...accountauthenticator/entry/src/main/js/MainAbility/app.js
+23
-22
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/i18n/en-US.json
...thenticator/entry/src/main/js/MainAbility/i18n/en-US.json
+7
-5
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/i18n/zh-CN.json
...thenticator/entry/src/main/js/MainAbility/i18n/zh-CN.json
+7
-5
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.css
...cator/entry/src/main/js/MainAbility/pages/index/index.css
+30
-0
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.hml
...cator/entry/src/main/js/MainAbility/pages/index/index.hml
+5
-5
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.js
...icator/entry/src/main/js/MainAbility/pages/index/index.js
+24
-15
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/ServiceAbility/service.js
...authenticator/entry/src/main/js/ServiceAbility/service.js
+54
-0
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/resources/base/element/string.json
...ticator/entry/src/main/resources/base/element/string.json
+20
-0
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/resources/base/media/icon.png
...uthenticator/entry/src/main/resources/base/media/icon.png
+0
-0
account/appaccount/sceneProject/actsaccountauthenticator/signature/openharmony_sx.p7b
...ect/actsaccountauthenticator/signature/openharmony_sx.p7b
+0
-0
未找到文件。
account/appaccount/BUILD.gn
浏览文件 @
5227bc04
...
@@ -22,6 +22,7 @@ group("appaccount_hap") {
...
@@ -22,6 +22,7 @@ group("appaccount_hap") {
"actssetchecksyncenable:ActsSetCheckSyncEnableTest",
"actssetchecksyncenable:ActsSetCheckSyncEnableTest",
"getallaccessibleaccounts:accessibleaccounts",
"getallaccessibleaccounts:accessibleaccounts",
"sceneProject:appaccount_scene",
"sceneProject:appaccount_scene",
"actsscenegetallaccounts:ActsSceneGetAllAccounts",
]
]
}
}
}
}
account/appaccount/actsaccountpressure/Test.json
已删除
100644 → 0
浏览文件 @
bd3e2178
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"1500000"
,
"package"
:
"com.example.actsaccountpressure"
,
"shell-timeout"
:
"60000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsAccountPressure.hap"
,
"ActsAccountSceneAppAccess.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
account/appaccount/actsaccountpressure/entry/src/main/js/default/pages/index/index.css
已删除
100644 → 0
浏览文件 @
bd3e2178
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
account/appaccount/actsaccountpressure/entry/src/main/js/resources/base/element/string.json
已删除
100644 → 0
浏览文件 @
bd3e2178
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"ActsAccountPressure"
},
{
"name"
:
"mainability_description"
,
"value"
:
"JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
account/appaccount/actsaccountpressure/entry/src/main/js/test/Pressure.test.js
已删除
100644 → 0
浏览文件 @
bd3e2178
此差异已折叠。
点击以展开。
account/appaccount/actsaccounttest/Test.json
浏览文件 @
5227bc04
...
@@ -12,7 +12,8 @@
...
@@ -12,7 +12,8 @@
"ActsAccountTest.hap"
,
"ActsAccountTest.hap"
,
"ActsAccountSceneAppAccess.hap"
,
"ActsAccountSceneAppAccess.hap"
,
"ActsAccountSceneOnOff.hap"
,
"ActsAccountSceneOnOff.hap"
,
"ActsAccountOauthtoken.hap"
"ActsAccountOauthtoken.hap"
,
"ActsAccountAuthenticator.hap"
],
],
"type"
:
"AppInstallKit"
,
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
"cleanup-apps"
:
true
...
...
account/appaccount/actsaccounttest/entry/src/main/js/test/Authenticator.test.js
0 → 100644
浏览文件 @
5227bc04
此差异已折叠。
点击以展开。
account/appaccount/actsaccounttest/entry/src/main/js/test/List.test.js
浏览文件 @
5227bc04
...
@@ -21,4 +21,5 @@ require('./Credential.test.js')
...
@@ -21,4 +21,5 @@ require('./Credential.test.js')
require
(
'
./OAuthToken.test.js
'
)
require
(
'
./OAuthToken.test.js
'
)
require
(
'
./CreatManager.test.js
'
)
require
(
'
./CreatManager.test.js
'
)
require
(
'
./NoPermission.test.js
'
)
require
(
'
./NoPermission.test.js
'
)
require
(
'
./OnOff.js
'
)
require
(
'
./OnOff.js
'
)
\ No newline at end of file
require
(
'
./Authenticator.test.js
'
)
\ No newline at end of file
account/appaccount/sceneProject/BUILD.gn
浏览文件 @
5227bc04
...
@@ -24,6 +24,7 @@ group("appaccount_scene") {
...
@@ -24,6 +24,7 @@ group("appaccount_scene") {
"actsaccountsceneappaccess:ActsAccountSceneAppAccess",
"actsaccountsceneappaccess:ActsAccountSceneAppAccess",
"actsaccountsceneonoff:ActsAccountSceneOnOff",
"actsaccountsceneonoff:ActsAccountSceneOnOff",
"actsscenegetallaccounts:ActsSceneGetAllAccounts",
"actsscenegetallaccounts:ActsSceneGetAllAccounts",
"actsaccountauthenticator:ActsAccountAuthenticator",
]
]
}
}
}
}
account/appaccount/
actsaccountpressure
/BUILD.gn
→
account/appaccount/
sceneProject/actsaccountauthenticator
/BUILD.gn
浏览文件 @
5227bc04
...
@@ -10,22 +10,29 @@
...
@@ -10,22 +10,29 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
import("//test/xts/tools/build/suite.gni")
ohos_
js_hap_suite("ActsAccountPressure
") {
ohos_
hap("ActsAccountAuthenticator
") {
hap_profile = "./entry/src/main/config.json"
hap_profile = "./entry/src/main/config.json"
hap_name = "ActsAccountAuthenticator"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
deps = [
":hjs_demo_js_assets",
":hjs_demo_js_assets",
":hjs_demo_js_service_assets",
":hjs_demo_resources",
":hjs_demo_resources",
]
]
certificate_profile = "./signature/openharmony_sx.p7b"
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAccountPressure"
}
}
ohos_js_assets("hjs_demo_js_assets") {
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
source_dir = "./entry/src/main/js/MainAbility"
}
ohos_js_assets("hjs_demo_js_service_assets") {
source_dir = "./entry/src/main/js/ServiceAbility"
}
}
ohos_resources("hjs_demo_resources") {
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/
js/
resources" ]
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
hap_profile = "./entry/src/main/config.json"
}
}
account/appaccount/
actsaccountpressure
/entry/src/main/config.json
→
account/appaccount/
sceneProject/actsaccountauthenticator
/entry/src/main/config.json
浏览文件 @
5227bc04
{
{
"app"
:
{
"app"
:
{
"bundleName"
:
"com.example.actsaccountpressure"
,
"vendor"
:
"example"
,
"vendor"
:
"example"
,
"bundleName"
:
"com.example.accountauthenticator"
,
"version"
:
{
"version"
:
{
"code"
:
1
,
"code"
:
1000000
,
"name"
:
"1.0"
"name"
:
"1.0.0"
},
},
"apiVersion"
:
{
"apiVersion"
:
{
"compatible"
:
4
,
"compatible"
:
7
,
"target"
:
5
,
"target"
:
7
"releaseType"
:
"Beta1"
}
}
},
},
"deviceConfig"
:
{},
"deviceConfig"
:
{},
"module"
:
{
"module"
:
{
"mainAbility"
:
".MainAbility"
,
"package"
:
"com.example.actsaccountpressure"
,
"deviceType"
:
[
"name"
:
".MyApplication"
,
"default"
,
"deviceType"
:
[
"tablet"
"phone"
],
],
"abilities"
:
[
"distro"
:
{
{
"deliveryWithInstall"
:
true
,
"skills"
:
[
"moduleName"
:
"entry"
,
{
"moduleType"
:
"entry"
"entities"
:
[
},
"entity.system.home"
"defPermissions"
:
[
],
{
"actions"
:
[
"availableScope"
:
[],
"action.system.home"
"grantMode"
:
"system_grant"
,
]
"name"
:
"ohos.permission.GET_ALL_APP_ACCOUNTS"
}
},
],
{
"orientation"
:
"unspecified"
,
"availableScope"
:
[],
"visible"
:
true
,
"grantMode"
:
"user_grant"
,
"srcPath"
:
"MainAbility"
,
"name"
:
"ohos.permission.DISTRIBUTED_DATASYNC"
"name"
:
".MainAbility"
,
}
"srcLanguage"
:
"js"
,
],
"icon"
:
"$media:icon"
,
"reqPermissions"
:
[
"description"
:
"$string:MainAbility_desc"
,
{
"formsEnabled"
:
false
,
"name"
:
"ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
,
"label"
:
"$string:MainAbility_label"
,
"reason"
:
"ceshi"
"type"
:
"page"
,
},
"launchType"
:
"standard"
{
},
"name"
:
"ohos.permission.GET_ALL_APP_ACCOUNTS"
,
{
"reason"
:
"ceshi"
"srcPath"
:
"ServiceAbility"
,
},
"name"
:
".ServiceAbility"
,
{
"srcLanguage"
:
"js"
,
"name"
:
"ohos.permission.DISTRIBUTED_DATASYNC"
,
"icon"
:
"$media:icon"
,
"reason"
:
"ceshi"
"description"
:
"$string:ServiceAbility_desc"
,
},
"type"
:
"service"
,
{
"visible"
:
true
,
"name"
:
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
,
"skills"
:
[{
"actions"
:
[
"reason"
:
"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
"ohos.account.appAccount.action.oauth"
},
]}]
{
}
"name"
:
"ohos.permission.GET_BUNDLE_INFO"
,
],
"reason"
:
"need use ohos.permission.GET_BUNDLE_INFO"
"distro"
:
{
},
"moduleType"
:
"entry"
,
{
"installationFree"
:
true
,
"name"
:
"ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
,
"deliveryWithInstall"
:
true
,
"reason"
:
"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
"moduleName"
:
"entry"
},
},
{
"package"
:
"com.example.entry"
,
"name"
:
"ohos.permission.REMOVE_CACHE_FILES"
,
"srcPath"
:
""
,
"reason"
:
"need use ohos.permission.REMOVE_CACHE_FILES"
"name"
:
".entry"
,
},
"js"
:
[
{
{
"name"
:
"ohos.permission.LISTEN_BUNDLE_CHANGE"
,
"pages"
:
[
"reason"
:
"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
"pages/index/index"
}
],
],
"name"
:
".MainAbility"
,
"abilities"
:
[
"window"
:
{
{
"designWidth"
:
720
,
"skills"
:
[
"autoDesignWidth"
:
false
{
}
"entities"
:
[
}
"entity.system.home"
]
],
}
"actions"
:
[
"action.system.home"
]
}
],
"name"
:
"com.example.actsaccountpressure.MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:mainability_description"
,
"label"
:
"$string:app_name"
,
"type"
:
"page"
,
"visible"
:
true
,
"launchType"
:
"standard"
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
}
\ No newline at end of file
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/Common/utils.js
0 → 100644
浏览文件 @
5227bc04
/*
* Copyright (c) 2021 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.
*/
import
account_appAccount
from
'
@ohos.account.appAccount
'
;
import
rpc
from
'
@ohos.rpc
'
;
var
TAG
=
"
[AccountTest]
"
class
MyParameter
{
constructor
(
params
,
size
)
{
this
.
params
=
params
this
.
size
=
size
}
marshalling
(
parcel
)
{
parcel
.
writeInt
(
this
.
size
)
console
.
log
(
TAG
+
"
size:
"
+
this
.
size
)
for
(
var
key
in
this
.
params
)
{
parcel
.
writeString
(
key
)
console
.
log
(
TAG
+
"
writeBoolean key:
"
+
key
)
var
value
=
this
.
params
[
key
]
switch
(
typeof
value
)
{
case
'
string
'
:
console
.
log
(
TAG
+
"
writeString value:
"
+
value
)
parcel
.
writeInt
(
9
)
parcel
.
writeString
(
value
)
break
case
'
boolean
'
:
console
.
log
(
TAG
+
"
writeBoolean value:
"
+
value
)
parcel
.
writeInt
(
1
)
parcel
.
writeBoolean
(
value
)
break
}
}
return
true
}
unmarshalling
(
parcel
)
{
this
.
size
=
parcel
.
readInt
()
console
.
log
(
TAG
+
"
size:
"
+
this
.
size
)
for
(
var
i
=
0
;
i
<
this
.
size
;
++
i
)
{
var
key
=
parcel
.
readString
()
console
.
log
(
TAG
+
"
key:
"
+
key
)
var
type
=
parcel
.
readInt
()
console
.
log
(
TAG
+
"
type:
"
+
type
)
var
value
=
null
switch
(
type
)
{
case
9
:
value
=
parcel
.
readString
()
break
case
1
:
value
=
parcel
.
readBool
()
break
}
console
.
log
(
TAG
+
"
value:
"
+
value
)
this
[
key
]
=
value
}
}
}
class
MyWant
{
constructor
(
bundleName
,
abilityName
,
parameters
)
{
this
.
bundleName
=
bundleName
this
.
abilityName
=
abilityName
this
.
paramSize
=
0
for
(
var
key
in
parameters
)
{
this
.
paramSize
++
}
this
.
parameters
=
new
MyParameter
(
parameters
,
this
.
paramSize
)
}
marshalling
(
parcel
)
{
// action
parcel
.
writeString
(
""
)
// uri
parcel
.
writeInt
(
-
1
)
// entities
parcel
.
writeInt
(
-
1
)
// flag
parcel
.
writeInt
(
0
)
if
(
this
.
bundleName
==
""
&&
this
.
abilityName
==
""
)
{
// element
parcel
.
writeInt
(
-
1
)
}
else
{
parcel
.
writeInt
(
1
)
}
// parameters
if
(
this
.
paramSize
>
0
)
{
parcel
.
writeInt
(
1
)
parcel
.
writeSequenceable
(
this
.
parameters
)
}
else
{
parcel
.
writeInt
(
-
1
)
}
// bundleName
parcel
.
writeString
(
this
.
bundleName
)
// picker
parcel
.
writeInt
(
-
1
)
return
true
}
unmarshalling
(
parcel
)
{
// action
console
.
log
(
TAG
+
"
action:
"
+
parcel
.
readString
());
// uri
console
.
log
(
TAG
+
"
uri:
"
+
parcel
.
readInt
());
// entities
console
.
log
(
TAG
+
"
entities:
"
+
parcel
.
readInt
());
// flag
console
.
log
(
TAG
+
"
flag:
"
+
parcel
.
readInt
())
// element
console
.
log
(
TAG
+
"
element:
"
+
parcel
.
readInt
())
// parameters
var
hasParam
=
parcel
.
readInt
()
console
.
log
(
TAG
+
"
hasParam:
"
+
hasParam
)
if
(
hasParam
==
1
)
{
parcel
.
readSequenceable
(
this
.
parameters
)
}
// bundleName
parcel
.
readString
()
// picker
parcel
.
readInt
()
return
true
;
}
}
class
VerifyCredentialOptions
{
constructor
(
credentialType
,
credential
,
parameters
)
{
this
.
credential
=
credential
this
.
credentialType
=
credentialType
this
.
parameters
=
new
MyParameter
(
parameters
,
0
)
}
unmarshalling
(
parcel
)
{
this
.
credentialType
=
readString8
(
parcel
)
this
.
credential
=
readString8
(
parcel
)
parcel
.
readSequenceable
(
this
.
parameters
)
return
true
}
}
class
SetPropertiesOptions
{
constructor
(
properties
,
parameters
)
{
this
.
properties
=
new
MyParameter
(
properties
,
0
)
this
.
parameters
=
new
MyParameter
(
parameters
,
0
)
}
unmarshalling
(
parcel
)
{
parcel
.
readSequenceable
(
this
.
properties
)
parcel
.
readSequenceable
(
this
.
parameters
)
return
true
}
}
function
readString8
(
data
)
{
var
size
=
data
.
readInt
()
var
padSize
=
(((
size
+
4
)
&
(
~
3
))
-
size
-
1
)
console
.
log
(
TAG
+
"
padSize:
"
+
padSize
)
var
str
=
""
var
count
=
0
for
(
var
i
=
0
;
i
<
(
size
+
1
+
padSize
)
/
4
;
++
i
)
{
var
result
=
data
.
readInt
()
if
(
count
!=
size
)
{
str
+=
String
.
fromCharCode
((
result
&
0x000000FF
))
count
++
}
if
(
count
!=
size
)
{
str
+=
String
.
fromCharCode
((
result
&
0x0000FF00
)
>>>
8
)
count
++
}
if
(
count
!=
size
)
{
str
+=
String
.
fromCharCode
((
result
&
0x00FF0000
)
>>>
16
)
count
++
}
if
(
count
!=
size
)
{
str
+=
String
.
fromCharCode
((
result
&
0xFF000000
)
>>>
24
)
count
++
}
}
return
str
}
function
readStringArray
(
data
)
{
var
size
=
data
.
readInt
()
console
.
log
(
TAG
+
"
label size:
"
+
size
)
var
result
=
[]
for
(
var
i
=
0
;
i
<
size
;
++
i
)
{
result
.
push
(
readString8
(
data
))
}
return
result
}
class
MyAuthenticatorCallback
{
constructor
(
callback
)
{
this
.
callback
=
callback
this
.
newData
=
new
rpc
.
MessageParcel
()
this
.
newReply
=
new
rpc
.
MessageParcel
()
this
.
newOptions
=
new
rpc
.
MessageOption
()
this
.
newData
.
writeInterfaceToken
(
"
ohos.accountfwk.IAppAccountAuthenticatorCallback
"
)
}
onResult
(
resultCode
,
result
)
{
this
.
newData
.
writeInt
(
resultCode
)
var
want
=
new
MyWant
(
""
,
""
,
result
)
this
.
newData
.
writeSequenceable
(
want
)
this
.
callback
.
sendRequest
(
0
,
this
.
newData
,
this
.
newReply
,
this
.
newOptions
)
}
onRequestRedirected
(
request
)
{
this
.
newData
.
writeSequenceable
(
request
)
this
.
callback
.
sendRequest
(
1
,
this
.
newData
,
this
.
newReply
,
this
.
newOptions
)
}
onRequestContinued
()
{
this
.
callback
.
sendRequest
(
2
,
this
.
newData
,
this
.
newReply
,
this
.
newOptions
)
}
}
class
MyAuthenticator
extends
rpc
.
RemoteObject
{
authenticatorImpl
=
new
MyAuthenticatorImpl
()
constructor
()
{
super
(
"
authenticator
"
)
}
onRemoteRequest
(
code
,
data
,
reply
,
options
)
{
console
.
log
(
TAG
+
"
code:
"
+
code
)
data
.
readInterfaceToken
()
var
name
=
null
var
callback
=
null
switch
(
code
)
{
case
2
:
name
=
readString8
(
data
)
var
verifyOptions
=
new
VerifyCredentialOptions
(
""
,
""
,
{})
data
.
readSequenceable
(
verifyOptions
)
callback
=
new
MyAuthenticatorCallback
(
data
.
readRemoteObject
())
this
.
authenticatorImpl
.
verifyCredential
(
name
,
verifyOptions
,
callback
)
break
case
3
:
name
=
readString8
(
data
)
var
labels
=
readStringArray
(
data
)
callback
=
new
MyAuthenticatorCallback
(
data
.
readRemoteObject
())
console
.
log
(
TAG
+
"
callback:
"
+
callback
)
this
.
authenticatorImpl
.
checkAccountLabels
(
name
,
labels
,
callback
)
break
case
4
:
var
setOptions
=
new
SetPropertiesOptions
({},
{})
data
.
readSequenceable
(
setOptions
)
callback
=
new
MyAuthenticatorCallback
(
data
.
readRemoteObject
())
this
.
authenticatorImpl
.
setProperties
(
setOptions
,
callback
)
break
case
5
:
name
=
readString8
(
data
)
callback
=
new
MyAuthenticatorCallback
(
data
.
readRemoteObject
())
this
.
authenticatorImpl
.
isAccountRemovable
(
name
,
callback
)
break
}
return
true
}
getRemoteObject
()
{
return
this
}
}
class
MyAuthenticatorImpl
{
accountLables
=
{
"
zhangsan
"
:
[
"
male
"
,
"
30-40
"
,
"
level4
"
],
"
lisi
"
:
[
"
female
"
]
}
accountCredentials
=
{
"
zhangsan
"
:
{
"
PIN
"
:
"
123456
"
,
"
NUMBER
"
:
"
12356789
"
},
"
lisi
"
:
{
"
FACE
"
:
"
X00001
"
}
}
accountRemovability
=
{
"
zhangsan
"
:
false
,
"
lisi
"
:
true
}
properties
=
{}
verifyCredential
(
name
,
options
,
callback
)
{
console
.
log
(
TAG
+
"
name:
"
+
name
+
"
, options:
"
+
JSON
.
stringify
(
options
))
if
(
name
==
"
xiaoming
"
)
{
callback
.
onRequestContinued
()
return
}
var
credentialInfo
=
this
.
accountCredentials
[
name
]
if
(
credentialInfo
==
undefined
)
{
callback
.
onResult
(
0
,
{
"
booleanResult
"
:
false
})
return
}
if
(
options
.
credentialType
==
undefined
||
options
.
credential
==
undefined
)
{
var
want
=
new
MyWant
(
"
com.ohos.accountauthenticator
"
,
"
VerifyAbility
"
,
{
"
credentialType
"
:
options
.
credentialType
,
"
credential
"
:
options
.
credential
})
callback
.
onRequestRedirected
(
want
)
return
}
var
credential
=
credentialInfo
[
options
.
credentialType
.
toUpperCase
()]
if
(
credential
==
undefined
||
credential
!=
options
.
credential
)
{
callback
.
onResult
(
0
,
{
"
booleanResult
"
:
false
})
return
}
callback
.
onResult
(
0
,
{
"
booleanResult
"
:
true
})
}
checkAccountLabels
(
name
,
labels
,
callback
)
{
console
.
log
(
TAG
+
"
name:
"
+
name
+
"
, labels:
"
+
JSON
.
stringify
(
labels
))
if
(
labels
.
length
==
0
)
{
callback
.
onResult
(
0
,
{
"
booleanResult
"
:
true
})
return
}
var
allLabels
=
this
.
accountLables
[
name
]
if
(
allLabels
==
undefined
||
allLabels
.
length
==
0
)
{
callback
.
onResult
(
0
,
{
"
booleanResult
"
:
false
})
return
}
for
(
var
i
=
0
;
i
<
labels
.
length
;
++
i
)
{
if
(
allLabels
.
indexOf
(
labels
[
i
])
==
-
1
)
{
callback
.
onResult
(
0
,
{
"
booleanResult
"
:
false
})
return
}
}
callback
.
onResult
(
0
,
{
"
booleanResult
"
:
true
})
}
setProperties
(
options
,
callback
)
{
console
.
log
(
TAG
+
"
options:
"
+
JSON
.
stringify
(
options
))
callback
.
onResult
(
10016
,
{})
}
isAccountRemovable
(
name
,
callback
)
{
console
.
log
(
TAG
+
"
name:
"
+
name
)
var
isRemovable
=
this
.
accountRemovability
[
name
]
if
(
isRemovable
==
undefined
||
isRemovable
==
false
)
{
callback
.
onResult
(
0
,
{
"
booleanResult
"
:
false
})
return
}
callback
.
onResult
(
0
,
{
"
booleanResult
"
:
true
})
}
}
export
{
MyAuthenticator
}
\ No newline at end of file
account/appaccount/
actsaccountpressure/entry/src/main/js/default
/app.js
→
account/appaccount/
sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility
/app.js
浏览文件 @
5227bc04
/*
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
export
default
{
onCreate
()
{
export
default
{
console
.
info
(
'
AceApplication onCreate
'
);
onCreate
()
{
},
console
.
info
(
"
Application onCreate
"
);
onDestroy
()
{
},
console
.
info
(
'
AceApplication onDestroy
'
);
onDestroy
()
{
}
console
.
info
(
"
Application onDestroy
"
);
};
},
};
account/appaccount/
actsaccountpressure/entry/src/main/js/default
/i18n/en-US.json
→
account/appaccount/
sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility
/i18n/en-US.json
浏览文件 @
5227bc04
{
{
"strings"
:
{
"strings"
:
{
"hello"
:
"Hello"
,
"hello"
:
"Hello"
,
"world"
:
"World"
"world"
:
"World"
}
},
"Files"
:
{
}
}
}
\ No newline at end of file
account/appaccount/
actsaccountpressure/entry/src/main/js/default
/i18n/zh-CN.json
→
account/appaccount/
sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility
/i18n/zh-CN.json
浏览文件 @
5227bc04
{
{
"strings"
:
{
"strings"
:
{
"hello"
:
"您好"
,
"hello"
:
"您好"
,
"world"
:
"世界"
"world"
:
"世界"
}
},
"Files"
:
{
}
}
}
\ No newline at end of file
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.css
0 → 100644
浏览文件 @
5227bc04
.container
{
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
left
:
0px
;
top
:
0px
;
width
:
100%
;
height
:
100%
;
}
.title
{
font-size
:
60px
;
text-align
:
center
;
width
:
100%
;
height
:
40%
;
margin
:
10px
;
}
@media
screen
and
(
device-type
:
default
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
60px
;
}
}
@media
screen
and
(
device-type
:
tablet
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
100px
;
}
}
\ No newline at end of file
account/appaccount/
actsaccountpressure/entry/src/main/js/default
/pages/index/index.hml
→
account/appaccount/
sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility
/pages/index/index.hml
浏览文件 @
5227bc04
<div class="container">
<div class="container">
<text class="title">
<text class="title">
{{title}}
{{title}}
</text>
</text>
</div>
</div>
account/appaccount/
actsaccountpressure/entry/src/main/js/test/List.test
.js
→
account/appaccount/
sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index
.js
浏览文件 @
5227bc04
/*
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
require
(
'
./Pressure.test.js
'
)
\ No newline at end of file
export
default
{
data
:
{
title
:
"
Hello World
"
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
}
account/appaccount/
actsaccountpressure/entry/src/main/js/default/pages/index/index
.js
→
account/appaccount/
sceneProject/actsaccountauthenticator/entry/src/main/js/ServiceAbility/service
.js
浏览文件 @
5227bc04
/*
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import
file
from
'
@system.file
'
import
{
Core
,
ExpectExtend
}
from
'
deccjsunit/index
'
import
account_appAccount
from
'
@ohos.account.appAccount
'
;
import
{
MyAuthenticator
}
from
'
../Common/utils
'
const
injectRef
=
Object
.
getPrototypeOf
(
global
)
||
global
injectRef
.
regeneratorRuntime
=
require
(
'
@babel/runtime/regenerator
'
)
var
TAG
=
"
[AccountTest]
"
var
authenticator
=
null
export
default
{
export
default
{
data
:
{
async
onStart
(
want
)
{
title
:
"
account pressure test
"
console
.
info
(
'
ServiceAbility onStart
'
);
},
var
accountMgr
=
account_appAccount
.
createAppAccountManager
();
onInit
()
{
try
{
this
.
title
=
"
account pressure test
"
;
await
accountMgr
.
addAccount
(
"
zhangsan
"
,
""
);
},
await
accountMgr
.
enableAppAccess
(
"
zhangsan
"
,
"
com.example.accounttest
"
);
onShow
()
{
await
accountMgr
.
addAccount
(
"
lisi
"
,
""
);
console
.
info
(
'
onShow finish
'
)
await
accountMgr
.
enableAppAccess
(
"
lisi
"
,
"
com.example.accounttest
"
);
const
core
=
Core
.
getInstance
()
await
accountMgr
.
addAccount
(
"
wangwu
"
,
""
);
const
expectExtend
=
new
ExpectExtend
({
await
accountMgr
.
enableAppAccess
(
"
wangwu
"
,
"
com.example.accounttest
"
);
'
id
'
:
'
extend
'
}
catch
(
err
)
{
})
console
.
error
(
TAG
+
"
addAccount or enableAppAccess failed, error:
"
+
JSON
.
stringify
(
err
))
core
.
addService
(
'
expect
'
,
expectExtend
)
}
core
.
init
()
console
.
info
(
'
ServiceAbility onStart end
'
);
},
const
configService
=
core
.
getDefaultService
(
'
config
'
)
async
onStop
()
{
this
.
timeout
=
180000
;
console
.
info
(
'
ServiceAbility onStop
'
);
configService
.
setConfig
(
this
)
},
onConnect
(
want
)
{
require
(
'
../../../test/List.test
'
)
console
.
info
(
'
ServiceAbility onConnect
'
);
core
.
execute
()
authenticator
=
new
MyAuthenticator
();
},
return
authenticator
.
getRemoteObject
();
onReady
()
{
},
},
onReconnect
(
want
)
{
}
console
.
info
(
'
ServiceAbility onReconnect
'
);
\ No newline at end of file
},
onDisconnect
()
{
console
.
info
(
'
ServiceAbility onDisconnect
'
);
},
onCommand
(
want
,
restart
,
startId
)
{
console
.
info
(
'
ServiceAbility onCommand
'
);
}
};
\ No newline at end of file
account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
5227bc04
{
"string"
:
[
{
"name"
:
"entry_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"ServiceAbility_desc"
,
"value"
:
"hap sample empty service"
}
]
}
\ No newline at end of file
account/appaccount/
actsaccountpressure/entry/src/main/js
/resources/base/media/icon.png
→
account/appaccount/
sceneProject/actsaccountauthenticator/entry/src/main
/resources/base/media/icon.png
浏览文件 @
5227bc04
文件已移动
account/appaccount/
actsaccountpressure
/signature/openharmony_sx.p7b
→
account/appaccount/
sceneProject/actsaccountauthenticator
/signature/openharmony_sx.p7b
浏览文件 @
5227bc04
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录