diff --git a/frameworks/native/executors/src/framework/framework_executor_callback.cpp b/frameworks/native/executors/src/framework/framework_executor_callback.cpp index 837d8464bcbb27a2baba83b9251b76a0e2408579..f42b1b803b2e115bf4630945eb0c967ea4880ca2 100644 --- a/frameworks/native/executors/src/framework/framework_executor_callback.cpp +++ b/frameworks/native/executors/src/framework/framework_executor_callback.cpp @@ -369,6 +369,7 @@ ResultCode FrameworkExecutorCallback::ProcessAbandonCommand(uint64_t scheduleId, ResultCode FrameworkExecutorCallback::FillPropertyToAttribute(const std::vector &keyList, const Property property, std::shared_ptr values) { + bool ret = false; for (auto &key : keyList) { switch (key) { case Attributes::ATTR_PIN_SUB_TYPE: { @@ -377,32 +378,36 @@ ResultCode FrameworkExecutorCallback::FillPropertyToAttribute(const std::vector< break; } case Attributes::ATTR_FREEZING_TIME: { - bool setAuthRemainTimeRet = - values->SetInt32Value(Attributes::ATTR_FREEZING_TIME, property.lockoutDuration); - IF_FALSE_LOGE_AND_RETURN_VAL(setAuthRemainTimeRet == true, ResultCode::GENERAL_ERROR); + ret = values->SetInt32Value(Attributes::ATTR_FREEZING_TIME, property.lockoutDuration); + IF_FALSE_LOGE_AND_RETURN_VAL(ret == true, ResultCode::GENERAL_ERROR); break; } case Attributes::ATTR_REMAIN_TIMES: { - bool setAuthRemainCountRet = - values->SetInt32Value(Attributes::ATTR_REMAIN_TIMES, property.remainAttempts); - IF_FALSE_LOGE_AND_RETURN_VAL(setAuthRemainCountRet == true, ResultCode::GENERAL_ERROR); + ret = values->SetInt32Value(Attributes::ATTR_REMAIN_TIMES, property.remainAttempts); + IF_FALSE_LOGE_AND_RETURN_VAL(ret == true, ResultCode::GENERAL_ERROR); break; } case Attributes::ATTR_ENROLL_PROGRESS: { - bool setEnrollProgressRet = - values->SetStringValue(Attributes::ATTR_ENROLL_PROGRESS, property.enrollmentProgress); - IF_FALSE_LOGE_AND_RETURN_VAL(setEnrollProgressRet == true, ResultCode::GENERAL_ERROR); + ret = values->SetStringValue(Attributes::ATTR_ENROLL_PROGRESS, property.enrollmentProgress); + IF_FALSE_LOGE_AND_RETURN_VAL(ret == true, ResultCode::GENERAL_ERROR); break; } case Attributes::ATTR_SENSOR_INFO: { - bool setSensorInfoRet = values->SetStringValue(Attributes::ATTR_SENSOR_INFO, property.sensorInfo); - IF_FALSE_LOGE_AND_RETURN_VAL(setSensorInfoRet == true, ResultCode::GENERAL_ERROR); + ret = values->SetStringValue(Attributes::ATTR_SENSOR_INFO, property.sensorInfo); + IF_FALSE_LOGE_AND_RETURN_VAL(ret == true, ResultCode::GENERAL_ERROR); break; } case Attributes::ATTR_NEXT_FAIL_LOCKOUT_DURATION: { - bool setNextFailLockoutDurationRet = values->SetInt32Value(Attributes::ATTR_NEXT_FAIL_LOCKOUT_DURATION, + ret = values->SetInt32Value(Attributes::ATTR_NEXT_FAIL_LOCKOUT_DURATION, property.nextFailLockoutDuration); - IF_FALSE_LOGE_AND_RETURN_VAL(setNextFailLockoutDurationRet == true, ResultCode::GENERAL_ERROR); + IF_FALSE_LOGE_AND_RETURN_VAL(ret == true, ResultCode::GENERAL_ERROR); + break; + } + case Attributes::ATTR_CREDENTIAL_LENGTH: { + if (property.credentialLength != 0) { + ret = values->SetUint32Value(Attributes::ATTR_CREDENTIAL_LENGTH, property.credentialLength); + IF_FALSE_LOGE_AND_RETURN_VAL(ret == true, ResultCode::GENERAL_ERROR); + } break; } default: diff --git a/interfaces/inner_api/attributes.h b/interfaces/inner_api/attributes.h index e7d2df8cba39c88362b42ef48ce2f33c2a4cb0ee..a1eea5065a5925ecb862c505bdb8e9095777b3fd 100644 --- a/interfaces/inner_api/attributes.h +++ b/interfaces/inner_api/attributes.h @@ -203,6 +203,8 @@ public: ATTR_TOKEN_TYPE = 100090, /* Token time interval between sign and verify, the value type is int64_t. */ ATTR_TOKEN_TIME_INTERVAL = 100091, + /* credential length, the value type is uint32_t. */ + ATTR_CREDENTIAL_LENGTH = 100092, }; /** diff --git a/interfaces/inner_api/iam_executor/iam_executor_framework_types.h b/interfaces/inner_api/iam_executor/iam_executor_framework_types.h index 6573b3f673ef797d688418c8abecd79b63a1817f..4e081036a6d7a7b5a5f92a91ca940aee975b5805 100644 --- a/interfaces/inner_api/iam_executor/iam_executor_framework_types.h +++ b/interfaces/inner_api/iam_executor/iam_executor_framework_types.h @@ -122,6 +122,8 @@ struct Property { std::string sensorInfo; /** Next fail lockout duration. */ int32_t nextFailLockoutDuration; + /** credential length. */ + uint32_t credentialLength; }; /** diff --git a/services/ipc/src/user_auth_service.cpp b/services/ipc/src/user_auth_service.cpp index 4e3a9d12eba863f1222a73bc01a90a728ccdec6a..cc888bed8203581e257b0a47059aec437e376713 100644 --- a/services/ipc/src/user_auth_service.cpp +++ b/services/ipc/src/user_auth_service.cpp @@ -87,7 +87,8 @@ bool IsTemplateIdListRequired(const std::vector &keys) if (key == Attributes::AttributeKey::ATTR_PIN_SUB_TYPE || key == Attributes::AttributeKey::ATTR_REMAIN_TIMES || key == Attributes::AttributeKey::ATTR_FREEZING_TIME || - key == Attributes::AttributeKey::ATTR_NEXT_FAIL_LOCKOUT_DURATION) { + key == Attributes::AttributeKey::ATTR_NEXT_FAIL_LOCKOUT_DURATION || + key == Attributes::AttributeKey::ATTR_CREDENTIAL_LENGTH) { return true; } }