From 88c6ea4f798f87aa9a562befad56d2710955c587 Mon Sep 17 00:00:00 2001 From: 15829070344 Date: Fri, 22 Jul 2022 16:11:31 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=B4=A6=E5=8F=B7=E3=80=91=E6=96=B0?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=94=A8=E4=BE=8B=E8=A6=86=E7=9B=96=EF=BC=8C?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7js=E5=B1=82=E5=8F=82=E6=95=B0=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E5=A4=B1=E8=B4=A5=E6=97=A0=E8=BF=94=E5=9B=9E=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 15829070344 --- account/appaccount/actsaccounttest/Test.json | 3 +- .../src/main/js/test/Authenticator.test.js | 636 ++++++++++++++++++ .../src/main/js/test/List.test.js | 2 + account/appaccount/sceneProject/BUILD.gn | 1 + .../actsaccountauthenticator/BUILD.gn | 38 ++ .../entry/src/main/config.json | 80 +++ .../entry/src/main/js/Common/utils.js | 344 ++++++++++ .../entry/src/main/js/MainAbility/app.js | 8 + .../src/main/js/MainAbility/i18n/en-US.json | 8 + .../src/main/js/MainAbility/i18n/zh-CN.json | 8 + .../main/js/MainAbility/pages/index/index.css | 30 + .../main/js/MainAbility/pages/index/index.hml | 5 + .../main/js/MainAbility/pages/index/index.js | 8 + .../src/main/js/ServiceAbility/service.js | 39 ++ .../main/resources/base/element/string.json | 20 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../signature/openharmony_sx.p7b | Bin 0 -> 3442 bytes .../src/main/js/test/OsAccountIs.test.js | 112 ++- 18 files changed, 1283 insertions(+), 59 deletions(-) create mode 100644 account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js create mode 100644 account/appaccount/sceneProject/actsaccountauthenticator/BUILD.gn create mode 100644 account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/config.json create mode 100644 account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/Common/utils.js create mode 100644 account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/app.js create mode 100644 account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/i18n/en-US.json create mode 100644 account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/i18n/zh-CN.json create mode 100644 account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.css create mode 100644 account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.hml create mode 100644 account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.js create mode 100644 account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/ServiceAbility/service.js create mode 100644 account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/resources/base/element/string.json create mode 100644 account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/resources/base/media/icon.png create mode 100644 account/appaccount/sceneProject/actsaccountauthenticator/signature/openharmony_sx.p7b diff --git a/account/appaccount/actsaccounttest/Test.json b/account/appaccount/actsaccounttest/Test.json index f1c6d4fab..53ccc60a4 100644 --- a/account/appaccount/actsaccounttest/Test.json +++ b/account/appaccount/actsaccounttest/Test.json @@ -13,7 +13,8 @@ "ActsAccountTest.hap", "ActsAccountSceneAppAccess.hap", "ActsAccountSceneOnOff.hap", - "ActsAccountOauthtoken.hap" + "ActsAccountOauthtoken.hap", + "ActsAccountAuthenticator.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js b/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js new file mode 100644 index 000000000..8505ea035 --- /dev/null +++ b/account/appaccount/actsaccounttest/src/main/js/test/Authenticator.test.js @@ -0,0 +1,636 @@ +/* + * 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 from '@ohos.account.appAccount' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +const NAMELIMIT = 512; +const LENGTHLIMIT = 1024; +const name = 'zhangsan' +const owner = 'com.example.accountauthenticator' +export default function ActsAccountAppAccess() { + describe('ActsAccountAuthenticator', function () { + + /* + * @tc.number : ActsAccountCheckAccountLabels_0100 + * @tc.name : Check Account Labels callback form + * @tc.desc : + */ + it('ActsAccountCheckAccountLabels_0100', 0, async function (done) { + console.debug("====>ActsAccountCheckAccountLabels_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>start finish===="); + appAccountManager.addAccount(name, 'test_extraInfo', (err)=>{ + console.debug("====>ActsAccountCheckAccountLabels_0100 add_account_err:" + JSON.stringify(err)); + expect(err.code).assertEqual(0); + appAccountManager.checkAccountLabels(name, owner, ['level4'], (err, data)=>{ + console.debug("====>ActsAccountCheckAccountLabels_0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(undefined); + console.debug("====>ActsAccountCheckAccountLabels_0100 data:" + JSON.stringify(data)); + appAccountManager.deleteAccount(name, (err) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0100 deleteAccount_err:" + JSON.stringify(err)) + expect(err.code).assertEqual(0); + console.debug("====>ActsAccountCheckAccountLabels_0100 end===="); + done(); + }) + }); + }); + }); + + + /* + * @tc.number : ActsAccountCheckAccountLabels_0200 + * @tc.name : Check Account Labels callback form + * @tc.desc : + */ + + it('ActsAccountCheckAccountLabels_0200', 0, async function (done) { + console.debug("====>ActsAccountCheckAccountLabels_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>start finish===="); + appAccountManager.addAccount(name, (err)=>{ + console.debug("====>ActsAccountCheckAccountLabels_0200 add_account_err:" + JSON.stringify(err)); + expect(err.code).assertEqual(0); + appAccountManager.checkAccountLabels(name, owner, ['20-30'], (err, data)=>{ + console.debug("====>ActsAccountCheckAccountLabels_0200 err:" + JSON.stringify(err)); + expect(err).assertEqual(undefined); + console.debug("====>ActsAccountCheckAccountLabels_0200 data:" + JSON.stringify(data)); + appAccountManager.deleteAccount(name, (err) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0200 deleteAccount_err:" + JSON.stringify(err)) + expect(err.code).assertEqual(0); + console.debug("====>ActsAccountCheckAccountLabels_0200 end===="); + done(); + }) + }); + }); + }); + + /* + * @tc.number : ActsAccountCheckAccountLabels_0300 + * @tc.name : Check Account Labels callback form + * @tc.desc : + */ + + it('ActsAccountCheckAccountLabels_0300', 0, async function (done) { + console.debug("====>ActsAccountCheckAccountLabels_0300 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>start finish===="); + appAccountManager.addAccount('CheckAccountLabels_0300', (err)=>{ + console.debug("====>ActsAccountCheckAccountLabels_0300 add_account_err:" + JSON.stringify(err)); + expect(err.code).assertEqual(0); + appAccountManager.checkAccountLabels('CheckAccountLabels_0300', owner, ['male'], (err, data)=>{ + console.debug("====>ActsAccountCheckAccountLabels_0300 err:" + JSON.stringify(err)); + expect(err).assertEqual(undefined); + console.debug("====>ActsAccountCheckAccountLabels_0300 data:" + JSON.stringify(data)); + expect(data).assertEqual(false) + appAccountManager.deleteAccount("CheckAccountLabels_0300", (err) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0300 deleteAccount_err:" + JSON.stringify(err)) + expect(err.code).assertEqual(0); + console.debug("====>ActsAccountCheckAccountLabels_0300 end===="); + done(); + }) + + }); + }); + + }); + + /* + * @tc.number : ActsAccountCheckAccountLabels_0400 + * @tc.name : Check Account Labels promise form + * @tc.desc : + */ + + it('ActsAccountCheckAccountLabels_0400', 0, async function (done) { + console.debug("====>ActsAccountCheckAccountLabels_0400 start===="); + var appAccountManager = account.createAppAccountManager(); + await appAccountManager.addAccount(name, 'test_extraInfo').then((data) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0400 add_account_success"); + appAccountManager.checkAccountLabels(name, owner, ['level4']).then((data) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0400 data:" + JSON.stringify(data)); + appAccountManager.deleteAccount(name).then((data) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0400 delete_account_success"); + }).catch((err) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0400 delete_account_err"); + }); + done(); + }).catch((err) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0400 err:" + JSON.stringify(err)) + expect(typeof(err) != undefined).assertTrue(); + done(); + }) + }).catch((err) => { + console.debug("====>ActsAccountCheckAccountLabels_0400 add_account_err:" + JSON.stringify(err)) + expect(err.code!=0).assertTrue(); + done(); + }) + }); + + /* + * @tc.number : ActsAccountCheckAccountLabels_0500 + * @tc.name : Check Account Labels promise form + * @tc.desc : + */ + + it('ActsAccountCheckAccountLabels_0500', 0, async function (done) { + console.debug("====>ActsAccountCheckAccountLabels_0500 start===="); + var appAccountManager = account.createAppAccountManager(); + await appAccountManager.addAccount(name, 'test_extraInfo').then((data) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0500 add_account_success"); + appAccountManager.checkAccountLabels(name, owner, ['20-30']).then((data) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0500 data:" + JSON.stringify(data)); + expect(account.Constants.KEY_REQUIRED_LABELS).assertEqual('requiredLabels') + expect(account.Constants.KEY_BOOLEAN_RESULT).assertEqual('booleanResult') + appAccountManager.deleteAccount(name).then((data) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0500 delete_account_success"); + }).catch((err) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0500 delete_account_err"); + }); + done() + }).catch((err) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0500 err:" + JSON.stringify(err)) + expect(typeof(err) != undefined).assertTrue(); + done(); + }) + }).catch((err) => { + console.debug("====>ActsAccountCheckAccountLabels_0500 add_account_err:" + JSON.stringify(err)) + expect().assertFail(); + done(); + }) + }); + + /* + * @tc.number : ActsAccountCheckAccountLabels_0600 + * @tc.name : Check Account Labels promise form + * @tc.desc : + */ + + it('ActsAccountCheckAccountLabels_0600', 0, async function (done) { + console.debug("====>ActsAccountCheckAccountLabels_0600 start===="); + var appAccountManager = account.createAppAccountManager(); + await appAccountManager.addAccount('CheckAccountLabels_0600', 'test_extraInfo').then((data) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0600 add_account_success:" + JSON.stringify(data)); + appAccountManager.checkAccountLabels('CheckAccountLabels_0600', owner, ['male']).then((data) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0600 data:" + JSON.stringify(data)); + appAccountManager.deleteAccount('CheckAccountLabels_0600').then((data) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0600 delete_account_success"); + }).catch((err) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0600 delete_account_err"); + }); + done() + }).catch((err) =>{ + console.debug("====>ActsAccountCheckAccountLabels_0600 err:" + JSON.stringify(err)) + expect().assertFail(); + done(); + }) + }).catch((err) => { + console.debug("====>ActsAccountCheckAccountLabels_0600 add_account_err:" + JSON.stringify(err)) + expect().assertFail(); + done(); + }) + }); + + /* + * @tc.number : ActsAccountCheckAppAccess_0100 + * @tc.name : Check App Access callback form + * @tc.desc : + */ + + it('ActsAccountCheckAppAccess_0100', 0, async function (done) { + console.debug("====>ActsAccountCheckAppAccess_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.addAccount(name, (err)=>{ + console.debug("====>ActsAccountCheckAppAccess_0100 add_account_err:" + JSON.stringify(err)); + expect(err.code).assertEqual(0); + appAccountManager.checkAppAccess(name, owner, (err, data)=>{ + console.debug("====>ActsAccountCheckAppAccess_0100 first_err:" + JSON.stringify(err)); + expect(err).assertEqual(undefined); + console.debug("====>ActsAccountCheckAppAccess_0100 first_data:" + JSON.stringify(data)); + expect(data).assertEqual(false) + appAccountManager.enableAppAccess(name, owner, (err, data) =>{ + console.debug("====>ActsAccountCheckAppAccess_0100 enableAppAccess_err:" + JSON.stringify(err)); + expect(err.code).assertEqual(0); + appAccountManager.checkAppAccess(name, owner, (err, data) =>{ + console.debug("====>ActsAccountCheckAppAccess_0100 second_err:" + JSON.stringify(err)); + expect(err).assertEqual(undefined); + expect(data).assertEqual(true) + appAccountManager.disableAppAccess(name, owner, (err, data) =>{ + console.debug("====>ActsAccountCheckAppAccess_0100 disableAppAccount_err:" + JSON.stringify(err)); + expect(err.code).assertEqual(0); + appAccountManager.checkAppAccess(name, owner,(err, data)=>{ + console.debug("====>ActsAccountCheckAppAccess_0100 third_err:" + JSON.stringify(err)) + expect(err).assertEqual(undefined) + expect(data).assertEqual(false) + try { + appAccountManager.deleteAccount(name) + console.debug('====>ActsAccountCheckAppAccess_0100 deleteAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountCheckAppAccess_0100 deleteAccount_err') + expect().assertFail() + } + }) + + }) + }) + }) + }); + }); + }); + + + /* + * @tc.number : ActsAccountCheckAppAccess_0200 + * @tc.name : Check App Access promise form + * @tc.desc : + */ + + it('ActsAccountCheckAppAccess_0200', 0, async function (done) { + console.debug("====>ActsAccountCheckAppAccess_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.addAccount(name, 'test_extraInfo').then((data) =>{ + console.debug("====>ActsAccountCheckAppAccess_0200 add_account_success:"); + appAccountManager.checkAppAccess(name, owner).then((data) =>{ + console.debug("====>ActsAccountCheckAppAccess_0200 first_data:" + JSON.stringify(data)); + expect(data).assertEqual(false); + appAccountManager.enableAppAccess(name, owner).then((data) =>{ + console.debug("====>ActsAccountCheckAppAccess_0200 enableAppAccess_success"); + appAccountManager.checkAppAccess(name, owner).then((data) =>{ + console.debug("====>ActsAccountCheckAppAccess_0200 second_data:" + JSON.stringify(data)); + expect(data).assertEqual(true); + appAccountManager.disableAppAccess(name, owner).then((data)=>{ + console.debug("====>ActsAccountCheckAppAccess_0200 disabAppAccess_data:" + JSON.stringify(data)); + appAccountManager.checkAppAccess(name, owner).then((data) =>{ + console.debug("====>ActsAccountCheckAppAccess_0200 third_data:" + JSON.stringify(data)); + expect(data).assertEqual(false); + try{ + appAccountManager.deleteAccount(name) + console.debug('====>ActsAccountCheckAppAccess_0200 deleteAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountCheckAppAccess_0100 deleteAccount_err') + expect().assertFail() + } + }).catch((err)=>{ + console.debug("====>ActsAccountCheckAppAccess_0200 third_err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + }).catch((err) =>{ + console.debug("====>ActsAccountCheckAppAccess_0200 disableAppAccess_err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + }).catch((err) =>{ + console.debug("====>ActsAccountCheckAppAccess_0200 second_err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + }).catch((err)=>{ + console.debug("====>ActsAccountCheckAppAccess_0200 enableAppAccess_err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + }).catch((err) =>{ + console.debug("====>ActsAccountCheckAppAccess_0200 first_err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + }).catch((err) => { + console.debug("====>ActsAccountCheckAppAccess_0200 addAccount_err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + + }); + + + /* + * @tc.number : ActsAccountDeleteAccountCredential_0100 + * @tc.name : Delete Account Credential callback form + * @tc.desc : + */ + + it('ActsAccountDeleteAccountCredential_0100', 0, async function (done) { + console.debug("====>ActsAccountDeleteAccountCredential_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>start finish===="); + appAccountManager.addAccount(name, (err)=>{ + console.debug("====>ActsAccountDeleteAccountCredential_0100 add_account_err:" + JSON.stringify(err)); + expect(err.code).assertEqual(0); + appAccountManager.setAccountCredential(name, "PIN", (err, data)=>{ + console.debug("====>ActsAccountDeleteAccountCredential_0100 setAccountCredential_err:" + JSON.stringify(err)); + expect(err.code).assertEqual(0); + console.debug("====>ActsAccountDeleteAccountCredential_0100 setAccountCredential_data:" + JSON.stringify(data)); + appAccountManager.getAccountCredential(name, "PIN", (err) =>{ + console.debug("====>ActsAccountDeleteAccountCredential_0100 getAccountCredential_err:" + JSON.stringify(err)) + expect(err.code).assertEqual(0); + console.debug("====>ActsAccountDeleteAccountCredential_0100 getAccountCredential_success:" + JSON.stringify(data)); + appAccountManager.deleteAccountCredential(name, "PIN", (err, data)=>{ + console.debug("====>ActsAccountDeleteAccountCredential_0100 deleteAccountCredential_err:" + JSON.stringify(err)); + expect(err).assertEqual(undefined); + expect(data).assertEqual(undefined); + console.debug("====>ActsAccountDeleteAccountCredential_0100 deleteAccountCredential_data:" + JSON.stringify(data)); + try{ + appAccountManager.deleteAccount(name) + console.debug('====>ActsAccountDeleteAccountCredential_0100 deleteAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountDeleteAccountCredential_0100 deleteAccount_err') + expect().assertFail() + done(); + } + }) + }) + }); + }); + }); + + /* + * @tc.number : ActsAccountDeleteAccountCredential_0200 + * @tc.name : Delete Account Credential promise form + * @tc.desc : + */ + + it('ActsAccountDeleteAccountCredential_0200', 0, async function (done) { + console.debug("====>ActsAccountDeleteAccountCredential_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + appAccountManager.addAccount(name, 'test_extraInfo').then((data) =>{ + console.debug("====>ActsAccountDeleteAccountCredential_0200 add_account_success"); + appAccountManager.setAccountCredential(name, "PIN").then((data) =>{ + console.debug("====>ActsAccountDeleteAccountCredential_0200 setAccountCredential_success"); + expect(data).assertEqual(undefined); + appAccountManager.getAccountCredential(name, "PIN").then((data) =>{ + console.debug("====>ActsAccountDeleteAccountCredential_0200 getAccountCredential_data:" + JSON.stringify(data)); + appAccountManager.deleteAccountCredential(name, "PIN").then((data) =>{ + console.debug("====>ActsAccountDeleteAccountCredential_0200 data:" + JSON.stringify(data)); + expect(data).assertEqual(undefined); //expect undefined assertEqual true + try{ + appAccountManager.deleteAccount(name) + console.debug('====>ActsAccountDeleteAccountCredential_0200 deleteAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountDeleteAccountCredential_0200 deleteAccount_err') + expect().assertFail() + } + }).catch((err) =>{ + console.debug("====>ActsAccountDeleteAccountCredential_0200 err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + }).catch((err)=>{ + console.debug("====>ActsAccountDeleteAccountCredential_0200 getAccountCredential_err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + }).catch((err) =>{ + console.debug("====>ActsAccountDeleteAccountCredential_0200 setAccountCredential_err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + }).catch((err) => { + console.debug("====>ActsAccountDeleteAccountCredential_0200 addAccount_err:" + JSON.stringify(err)); + expect().assertFail(); + done(); + }) + }); + + /* + * @tc.number : ActsAccountVerifyCredential_0100 + * @tc.name : Verify Credential callback form, options + * @tc.desc : + */ + + it('ActsAccountVerifyCredential_0100', 0, async function (done) { + console.debug("====>ActsAccountVerifyCredential_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + var options = {credentialType: "PIN", credential: "123456"} + console.debug("====>start finish===="); + appAccountManager.addAccount(name, (err)=>{ + console.debug("====>ActsAccountVerifyCredential_0100 add_account_err:" + JSON.stringify(err)); + expect(err.code).assertEqual(0); + appAccountManager.verifyCredential(name, owner, options, { + onResult:(resultCode, resultData)=>{ + console.debug("====>ActsAccountVerifyCredential_0100 verifyCredential_resultcode:" + JSON.stringify(resultCode)); + expect(resultCode).assertEqual(0) + console.debug("====>ActsAccountVerifyCredential_0100 verifyCredential_resultData:" + JSON.stringify(resultData)); + expect(resultData.booleanResult).assertEqual(true) + try{ + appAccountManager.deleteAccount(name) + console.debug('====>ActsAccountVerifyCredential_0100 deleteAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountVerifyCredential_0100 deleteAccount_err') + expect().assertFail() + } + done(); + }, + onRequestRedirected:null, + onRequestContinued: function(){ + console.debug("====>ActsAccountVerifyCredential_0100 verifyCredential_onRequestContinued") + } + }); + }); + }); + + /* + * @tc.number : ActsAccountVerifyCredential_0200 + * @tc.name : Verify Credential callback form + * @tc.desc : + */ + + it('ActsAccountVerifyCredential_0200', 0, async function (done) { + console.debug("====>ActsAccountVerifyCredential_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>start finish===="); + appAccountManager.addAccount(name, (err)=>{ + console.debug("====>ActsAccountVerifyCredential_0200 add_account_err:" + JSON.stringify(err)); + expect(err.code).assertEqual(0); + console.debug("====>ActsAccountVerifyCredential_0200 add_account_err:" + JSON.stringify(err)); + expect(err.code).assertEqual(0); + appAccountManager.verifyCredential(name, owner, { + onResult:(resultCode, resultData)=>{ + console.debug("====>ActsAccountVerifyCredential_0200 verifyCredential_resultcode:" + JSON.stringify(resultCode)); + expect(resultCode).assertEqual(0) + console.debug("====>ActsAccountVerifyCredential_0200 verifyCredential_resultData:" + JSON.stringify(resultData)); + expect(resultData.booleanResult).assertEqual(false) + try{ + appAccountManager.deleteAccount(name) + console.debug('====>ActsAccountVerifyCredential_0200 deleteAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountVerifyCredential_0200 deleteAccount_err') + expect().assertFail() + } + done(); + }, + onRequestRedirected:null, + onRequestContinued: function(){ + console.debug("====>ActsAccountVerifyCredential_0200 verifyCredential_onRequestContinued") + } + }); + }); + }); + + /* + * @tc.number : ActsAccountSetAuthenticatorProperties_0100 + * @tc.name : Verify Credential callback form, options + * @tc.desc : + */ + + it('ActsAccountSetAuthenticatorProperties_0100', 0, async function (done) { + console.debug("====>ActsAccountSetAuthenticatorProperties_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + var options = {credentialType: "PIN", credential: "123456"} + console.debug("====>start finish===="); + appAccountManager.addAccount(name, (err)=>{ + console.debug("====>ActsAccountSetAuthenticatorProperties_0100 add_account_err:" + JSON.stringify(err)); + expect(err.code).assertEqual(0); + appAccountManager.setAuthenticatorProperties(owner, options, { + onResult:(resultCode, resultData)=>{ + console.debug("====>ActsAccountSetAuthenticatorProperties_0100 setAuthenticatorProperties_resultcode:" + JSON.stringify(resultCode)); + expect(resultCode).assertEqual(10016) + console.debug("====>ActsAccountSetAuthenticatorProperties_0100 setAuthenticatorProperties_resultData:" + JSON.stringify(resultData)); + try{ + appAccountManager.deleteAccount(name) + console.debug('====>ActsAccountSetAuthenticatorProperties_0100 deleteAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountSetAuthenticatorProperties_0100 deleteAccount_err') + expect().assertFail() + } + done(); + }, + onRequestRedirected:null, + onRequestContinued: function(){ + console.debug("====>ActsAccountSetAuthenticatorProperties_0100 verifyCredential_onRequestContinued") + } + }); + }); + }); + + /* + * @tc.number : ActsAccountSetAuthenticatorProperties_0200 + * @tc.name : Verify Credential callback form + * @tc.desc : + */ + + it('ActsAccountSetAuthenticatorProperties_0200', 0, async function (done) { + console.debug("====>ActsAccountSetAuthenticatorProperties_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>start finish===="); + appAccountManager.addAccount(name, (err)=>{ + console.debug("====>ActsAccountSetAuthenticatorProperties_0200 add_account_err:" + JSON.stringify(err)); + expect(err.code).assertEqual(0); + appAccountManager.setAuthenticatorProperties(owner, { + onResult:(resultCode, resultData)=>{ + console.debug("====>ActsAccountSetAuthenticatorProperties_0200 setAuthenticatorProperties_resultcode:" + JSON.stringify(resultCode)); + expect(resultCode).assertEqual(10016) + console.debug("====>ActsAccountSetAuthenticatorProperties_0200 setAuthenticatorProperties_resultData:" + JSON.stringify(resultData)); + try{ + appAccountManager.deleteAccount(name) + console.debug('====>ActsAccountSetAuthenticatorProperties_0200 deleteAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountSetAuthenticatorProperties_0200 deleteAccount_err') + expect().assertFail() + } + done(); + }, + onRequestRedirected:null, + onRequestContinued: function(){ + console.debug("====>ActsAccountSetAuthenticatorProperties_0200 verifyCredential_onRequestContinued") + } + }); + }); + }); + + /* + * @tc.number : ActsAccountSelectAccountByOptions_0100 + * @tc.name : Verify Credential callback form + * @tc.desc : + */ + + it('ActsAccountSelectAccountByOptions_0100', 0, async function (done) { + console.debug("====>ActsAccountSelectAccountByOptions_0100 start===="); + var appAccountManager = account.createAppAccountManager(); + var select_options = {"allowedAccounts":[{"name":name,"owner":owner}]} + console.debug("====>start finish===="); + appAccountManager.addAccount(name, (err)=>{ + console.debug("====>ActsAccountSelectAccountByOptions_0100 add_account_err:" + JSON.stringify(err)); + expect(err.code).assertEqual(0); + appAccountManager.selectAccountsByOptions(select_options, ((err, data)=>{ + console.debug("====>ActsAccountSelectAccountByOptions_0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(undefined) + console.debug("====>ActsAccountSelectAccountByOptions_0100 data:" + JSON.stringify(data.length)); + expect(data.length).assertEqual(0) + done(); + })) + try{ + appAccountManager.deleteAccount(name) + console.debug('====>ActsAccountSelectAccountByOptions_0100 deleteAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountSelectAccountByOptions_0100 deleteAccount_err') + expect().assertFail() + } + }); + }); + + /* + * @tc.number : ActsAccountSelectAccountByOptions_0100 + * @tc.name : Verify Credential callback form + * @tc.desc : + */ + + it('ActsAccountSelectAccountByOptions_0200', 0, async function (done) { + console.debug("====>ActsAccountSelectAccountByOptions_0200 start===="); + var appAccountManager = account.createAppAccountManager(); + var select_options = {"allowedOwners": [owner]} + console.debug("====>start finish===="); + appAccountManager.addAccount(name, (err)=>{ + console.debug("====>ActsAccountSelectAccountByOptions_0200 add_account_err:" + JSON.stringify(err)); + expect(err.code).assertEqual(0); + appAccountManager.selectAccountsByOptions(select_options).then((data)=>{ + console.debug("====>ActsAccountSelectAccountByOptions_0200 data:" + JSON.stringify(data.length)); + expect(data.length).assertEqual(0) + done(); + }).catch(()=>{ + onsole.debug("====>ActsAccountSelectAccountByOptions_0200 err:" + JSON.stringify(err)); + expect(err).assertEqual(undefined) + done() + }) + try{ + appAccountManager.deleteAccount(name) + console.debug('====>ActsAccountSelectAccountByOptions_0200 deleteAccount_success') + done(); + } + catch{ + console.debug('====>ActsAccountSelectAccountByOptions_0200 deleteAccount_err') + expect().assertFail() + } + }); + }); + + }) +} \ No newline at end of file diff --git a/account/appaccount/actsaccounttest/src/main/js/test/List.test.js b/account/appaccount/actsaccounttest/src/main/js/test/List.test.js index 6c1628bda..649bd9330 100755 --- a/account/appaccount/actsaccounttest/src/main/js/test/List.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/List.test.js @@ -22,6 +22,7 @@ import ActsAccountOAuthToken from './OAuthToken.test.js' import ActsCreatAppAccountManager from './CreatManager.test.js' import ActsAccountNoPermission from './NoPermission.test.js' import ActsAccountChangeOnOff from './OnOff.js' +import ActsAccountAuthenticator from './Authenticator.test.js' export default function testsuite() { ActsAccountAddAccount() ActsAccountAppAccess() @@ -33,4 +34,5 @@ export default function testsuite() { ActsAccountNoPermission() ActsAccountOAuthToken() ActsAccountChangeOnOff() + ActsAccountAuthenticator() } \ No newline at end of file diff --git a/account/appaccount/sceneProject/BUILD.gn b/account/appaccount/sceneProject/BUILD.gn index e01a05bb4..50857a757 100644 --- a/account/appaccount/sceneProject/BUILD.gn +++ b/account/appaccount/sceneProject/BUILD.gn @@ -24,6 +24,7 @@ group("appaccount_scene") { "actsaccountsceneappaccess:ActsAccountSceneAppAccess", "actsaccountsceneonoff:ActsAccountSceneOnOff", "actsscenegetallaccounts:ActsSceneGetAllAccounts", + "actsaccountauthenticator:ActsAccountAuthenticator" ] } } diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/BUILD.gn b/account/appaccount/sceneProject/actsaccountauthenticator/BUILD.gn new file mode 100644 index 000000000..704be2d37 --- /dev/null +++ b/account/appaccount/sceneProject/actsaccountauthenticator/BUILD.gn @@ -0,0 +1,38 @@ +# 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("//test/xts/tools/build/suite.gni") + +ohos_hap("ActsAccountAuthenticator") { + 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 = [ + ":hjs_demo_js_assets", + ":hjs_demo_js_service_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" +} +ohos_js_assets("hjs_demo_js_assets") { + 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") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/config.json b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/config.json new file mode 100644 index 000000000..dd3a52906 --- /dev/null +++ b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/config.json @@ -0,0 +1,80 @@ +{ + "app": { + "vendor": "example", + "bundleName": "com.example.accountauthenticator", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "default", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "js", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + }, + { + "srcPath": "ServiceAbility", + "name": ".ServiceAbility", + "srcLanguage": "js", + "icon": "$media:icon", + "description": "$string:ServiceAbility_desc", + "type": "service", + "visible": true, + "skills": [{"actions": [ + "ohos.account.appAccount.action.oauth" + ]}] + } + ], + "distro": { + "moduleType": "entry", + "installationFree": true, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/Common/utils.js b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/Common/utils.js new file mode 100644 index 000000000..6766a02b8 --- /dev/null +++ b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/Common/utils.js @@ -0,0 +1,344 @@ +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 diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/app.js b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/app.js new file mode 100644 index 000000000..b1165a8da --- /dev/null +++ b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info("Application onCreate"); + }, + onDestroy() { + console.info("Application onDestroy"); + }, +}; diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/i18n/en-US.json b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 000000000..3cb24b374 --- /dev/null +++ b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/i18n/zh-CN.json b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 000000000..c804e32c0 --- /dev/null +++ b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.css b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 000000000..92c57fcd3 --- /dev/null +++ b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,30 @@ +.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 diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.hml b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 000000000..c6c693b48 --- /dev/null +++ b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{title}} + +
diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.js b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 000000000..db31ed160 --- /dev/null +++ b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,8 @@ +export default { + data: { + title: "Hello World" + }, + onInit() { + this.title = this.$t('strings.world'); + }, +} diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/ServiceAbility/service.js b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/ServiceAbility/service.js new file mode 100644 index 000000000..b455cfe7e --- /dev/null +++ b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/js/ServiceAbility/service.js @@ -0,0 +1,39 @@ +import account_appAccount from '@ohos.account.appAccount'; +import {MyAuthenticator} from '../Common/utils' + +var TAG = "[AccountTest]" +var authenticator = null +export default { + async onStart(want) { + console.info('ServiceAbility onStart'); + var accountMgr = account_appAccount.createAppAccountManager(); + try { + await accountMgr.addAccount("zhangsan", ""); + await accountMgr.enableAppAccess("zhangsan", "com.example.accounttest"); + await accountMgr.addAccount("lisi", ""); + await accountMgr.enableAppAccess("lisi", "com.example.accounttest"); + await accountMgr.addAccount("wangwu", ""); + await accountMgr.enableAppAccess("wangwu", "com.example.accounttest"); + } catch(err) { + console.error(TAG + "addAccount or enableAppAccess failed, error: " + JSON.stringify(err)) + } + console.info('ServiceAbility onStart end'); + }, + async onStop() { + console.info('ServiceAbility onStop'); + }, + onConnect(want) { + console.info('ServiceAbility onConnect'); + authenticator = new MyAuthenticator(); + return authenticator.getRemoteObject(); + }, + onReconnect(want) { + console.info('ServiceAbility onReconnect'); + }, + onDisconnect() { + console.info('ServiceAbility onDisconnect'); + }, + onCommand(want, restart, startId) { + console.info('ServiceAbility onCommand'); + } +}; \ No newline at end of file diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/resources/base/element/string.json b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/resources/base/element/string.json new file mode 100644 index 000000000..950af876a --- /dev/null +++ b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/resources/base/element/string.json @@ -0,0 +1,20 @@ +{ + "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 diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/resources/base/media/icon.png b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$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IL|2dO+;+b%^ZvBlRl%OTpT3BPZ2Bc7$=ZKy zN5IP|oP5C6 zu=&u(-?F=3+PLLX^`Uk9@;gSZIX~)1Y4^m}md%hyYj?I!kZis9K|na!Ys+Ug@xhdL zru;InpmTDvdF+lgeQm3OVQ#bfyD)l#-qEyWb065)XjuU3x?G-jR|WOX%tqrvjhqhKbWtIr4vS?5W~5?1m9|5&+2u z{wqIMEdMQYXX)?mm3r#-oG#va{aE_xOBvS}yV6ZJbk=JtmW}sx>HmH4R#)aHw=Rw0 z#Ol{~gHl)Aro86NYoABWEtHw3K8*7Q{w2fKg{!sST?8^mE zj0bZho5Q^hK*Mt>+t)L{bD0H}=Exg$E`)GEx$uH11O5u0)^&a(S_= zqy`i|9u-1jVcuFgr(k5xqDILM=e~ zc{#;vD-tsmmGjTOa;B*7yD=xXwyzeC*e}ny+-|#O-3sw1C7i80M~^ssbgpv!d$W#+ YX9HpW+h1JFRc8v8e%3PML|^*<0J%6(*8l(j literal 0 HcmV?d00001 diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js index 9f1904166..62e128bb8 100755 --- a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js +++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js @@ -169,18 +169,12 @@ export default function ActsOsAccountThirdPartyTest_third_1() { var AccountManager = osAccount.getAccountManager(); console.debug("====>get os AccountManager finish===="); var localIdStr = "100"; - function funcIsActived(err, data){ - console.debug("====>error received callback===="); + AccountManager.isOsAccountActived(localIdStr, (err, data)=>{ console.debug("====>receive isOsAccountActived err: " + JSON.stringify(err)); + expect(err.code !=0 ).assertEqual(true) console.debug("====>receive isOsAccountActived data: " + JSON.stringify(data)); - expect().assertFail(); done(); - } - AccountManager.isOsAccountActived(localIdStr, funcIsActived); - setTimeout(()=>{ - console.debug("====>ActsOsAccountIsActived_0500 end===="); - done(); - }, TIMEOUT); + }); }) /* @@ -193,11 +187,14 @@ export default function ActsOsAccountThirdPartyTest_third_1() { var AccountManager = osAccount.getAccountManager(); console.debug("====>get os AccountManager finish===="); var localIdStr = "100"; - var isActived = await AccountManager.isOsAccountActived(localIdStr); - console.debug("====>get active status is: " + isActived); - expect(isActived).assertEqual(null); - console.debug("====>ActsOsAccountIsActived_0600 end===="); - done(); + AccountManager.isOsAccountActived(localIdStr).then((data)=>{ + console.debug("====>get active status is: " + JSON.stringify(data)); + done(); + }).catch((err)=>{ + expect(err.code !=0 ).assertEqual(true) + console.debug("====>ActsOsAccountIsActived_0600 err:" + JSON.stringify(err)); + done(); + }) }) /* @@ -209,18 +206,12 @@ export default function ActsOsAccountThirdPartyTest_third_1() { console.debug("====>ActsOsAccountIsActived_0700 start"); var AccountManager = osAccount.getAccountManager(); console.debug("====>get os AccountManager finish===="); - function funcIsActived(err, data){ - console.debug("====>error received callback===="); - console.debug("====>receive isOsAccountActived err: " + JSON.stringify(err)); + AccountManager.isOsAccountActived(undefined, (err, data)=>{ + console.debug("====>ActsOsAccountIsActived_0700 err:" + JSON.stringify(err)); + expect(err != 0).assertEqual(true) console.debug("====>receive isOsAccountActived data: " + JSON.stringify(data)); - expect().assertFail(); - done(); - } - AccountManager.isOsAccountActived(undefined, funcIsActived); - setTimeout(()=>{ - console.debug("====>ActsOsAccountIsActived_0700 end===="); done(); - }, TIMEOUT); + }) }) /* @@ -231,12 +222,16 @@ export default function ActsOsAccountThirdPartyTest_third_1() { it('ActsOsAccountIsActived_0800', 0, async function(done){ console.debug("====>ActsOsAccountIsActived_0800 start===="); var AccountManager = osAccount.getAccountManager(); - console.debug("====>get os AccountManager finish===="); - var isActived = await AccountManager.isOsAccountActived(undefined); - console.debug("====>get active status is: " + isActived); - expect(isActived).assertEqual(null); - console.debug("====>ActsOsAccountIsActived_0800 end===="); - done(); + console.debug("====>ActsOsAccountIsActived_0800 get os AccountManager finish===="); + AccountManager.isOsAccountActived(undefined).then((data)=>{ + console.debug("====>ActsOsAccountIsActived_0800 get active status is: " + JSON.stringify(data)); + done() + }).catch((err)=>{ + console.debug("====>ActsOsAccountIsActived_0800 err:" + JSON.stringify(err)) + expect(err != 0).assertEqual(true); + console.debug("====>ActsOsAccountIsActived_0800 end===="); + done(); + }) }) /* @@ -359,18 +354,14 @@ export default function ActsOsAccountThirdPartyTest_third_1() { var AccountManager = osAccount.getAccountManager(); console.debug("====>get os AccountManager finish===="); var localIdStr = "100"; - function funcIsVerified(err, data){ + AccountManager.isOsAccountVerified(localIdStr, (err, data)=>{ console.debug("====>error received callback===="); console.debug("====>receive isOsAccountVerified err: " + JSON.stringify(err)); + expect(err.code).assertEqual(0); + expect(data).assertEqual(false); console.debug("====>receive isOsAccountVerified data: " + JSON.stringify(data)); - expect().assertFail(); done(); - } - AccountManager.isOsAccountVerified(localIdStr, funcIsVerified); - setTimeout(()=>{ - console.debug("====>ActsOsAccountIsVerified_0500 end===="); - done(); - }, TIMEOUT); + }) }) /* @@ -383,11 +374,15 @@ export default function ActsOsAccountThirdPartyTest_third_1() { var AccountManager = osAccount.getAccountManager(); console.debug("====>get os AccountManager finish===="); var localIdStr = "100"; - var isVerified = await AccountManager.isOsAccountVerified(localIdStr); - console.debug("====>get verified status is: " + isVerified); - expect(isVerified).assertEqual(null); - console.debug("====>ActsOsAccountIsVerified_0600 end===="); - done(); + AccountManager.isOsAccountVerified(localIdStr).then((data)=>{ + expect(data).assertEqual(false); // + console.debug("====>ActsOsAccountIsVerified_0600 end===="); + done(); + }).catch((err)=>{ + console.debug("====>get verified err: " + JSON.stringify(err)); + expect().assertFail() + done(); + }) }) /* @@ -400,18 +395,14 @@ export default function ActsOsAccountThirdPartyTest_third_1() { var AccountManager = osAccount.getAccountManager(); console.debug("====>get os AccountManager finish===="); var localIdUndefined = undefined; - function funcIsVerified(err, data){ - console.debug("====>error received callback===="); - console.debug("====>receive isOsAccountVerified err: " + JSON.stringify(err)); - console.debug("====>receive isOsAccountVerified data: " + JSON.stringify(data)); - expect().assertFail(); - done(); - } - AccountManager.isOsAccountVerified(localIdUndefined, funcIsVerified); - setTimeout(()=>{ + AccountManager.isOsAccountVerified(localIdUndefined, (err, data) =>{ + console.debug("====>ActsOsAccountIsVerified_0700 isOsAccountVerified_err:" + JSON.stringify(err)) + expect(err.code).assertEqual(0) + console.debug("====>ActsOsAccountIsVerified_0700 isOsAccountVerified_data:" + JSON.stringify(data)) + expect(data).assertEqual(false) console.debug("====>ActsOsAccountIsVerified_0700 end===="); done(); - }, TIMEOUT); + }); }) /* @@ -424,11 +415,16 @@ export default function ActsOsAccountThirdPartyTest_third_1() { var AccountManager = osAccount.getAccountManager(); console.debug("====>get os AccountManager finish===="); var localIdUndefined = undefined; - var isVerified = await AccountManager.isOsAccountVerified(localIdUndefined); - console.debug("====>get verified status is: " + isVerified); - expect(isVerified).assertEqual(null); - console.debug("====>ActsOsAccountIsVerified_0800 end===="); - done(); + AccountManager.isOsAccountVerified(localIdUndefined).then((data)=>{ + console.debug("====>ActsOsAccountIsVerified_0800 isOsAccountVerified_data:" + JSON.stringify(data)) + expect(data).assertEqual(false) + console.debug("====>ActsOsAccountIsVerified_0700 end===="); + done(); + }).catch((err)=>{ + console.debug("====>ActsOsAccountIsVerified_0700 isOsAccountVerified_err:" + JSON.stringify(err)) + expect(err.code !=0 ).assertEqual(true) + done(); + }) }) /* -- GitLab