2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
17 #ifndef __PASSWORD_POLICY__
18 #define __PASSWORD_POLICY__
20 #include "policy-context.hxx"
22 namespace DevicePolicyManager {
24 class PasswordPolicy {
27 DPM_PASSWORD_QUALITY_UNSPECIFIED = 0x00, /**< No requirements for password. */
28 DPM_PASSWORD_QUALITY_SIMPLE_PASSWORD = 0x01, /**< Eas requirement for simple password */
29 DPM_PASSWORD_QUALITY_SOMETHING = 0x10, /**< Some kind password is required, but doesn't care what it is */
30 DPM_PASSWORD_QUALITY_NUMERIC = 0x20, /**< Containing at least numeric characters */
31 DPM_PASSWORD_QUALITY_ALPHABETIC = 0x40, /**< Containing at least alphabetic (or other symbol) characters */
32 DPM_PASSWORD_QUALITY_ALPHANUMERIC = 0x80, /**< Containing at least numeric and alphabetic characters */
33 } PasswordPolicyQuality;
36 DPM_PASSWORD_STATUS_NORMAL, /**< Password normal status */
37 DPM_PASSWORD_STATUS_CHANGED, /**< Password successfully changed */
38 DPM_PASSWORD_STATUS_NOT_CHANGED, /**< Password not changed */
39 DPM_PASSWORD_STATUS_CHANGE_REQUIRED , /**< Password change required */
40 DPM_PASSWORD_STATUS_MAX_ATTEMPTS_EXCEEDED, /**< Password Max Attempts Exceeded*/
42 DPM_PASSWORD_STATUS_EXPIRED, /**< Password expired */
43 DPM_PASSWORD_STATUS_RECOVERY_PASSWORD_FAILED, /**< Device unlock failed by Password Recovery */
44 DPM_PASSWORD_STATUS_RECOVERY_PASSWORD_SUCCEEDED,/**< Device unlock succeeded by Password Recovery */
46 DPM_PASSWORD_STATUS_QUALITY_CHANGED, /**< Password quality successfully changed */
47 DPM_PASSWORD_STATUS_MIN_LENGTH_CHANGED, /**< Password min_length successfully changed */
48 DPM_PASSWORD_STATUS_COMPLEX_CHAR_CHANGED, /**< Password complex_char successfully changed */
49 DPM_PASSWORD_STATUS_PATTERN_CHANGED, /**< Password pattern successfully changed */
50 DPM_PASSWORD_STATUS_MAX
51 } PasswordPolicyStatus;
53 PasswordPolicy(PolicyControlContext &ctxt);
56 PasswordPolicy(const PasswordPolicy& rhs);
57 PasswordPolicy(PasswordPolicy&& rhs);
59 PasswordPolicy& operator=(const PasswordPolicy& rhs);
60 PasswordPolicy& operator=(PasswordPolicy&& rhs);
62 int setQuality(int quality);
64 int setMinimumLength(int value);
65 int getMinimumLength();
66 int setMinComplexChars(int value);
67 int getMinComplexChars();
68 int setMaximumFailedForWipe(int value);
69 int getMaximumFailedForWipe();
70 int setExpires(int value);
72 int setHistory(int value);
74 int setPattern(const std::string &pattern);
75 int reset(const std::string &passwd);
77 int setMaxInactivityTimeDeviceLock(int value);
78 int getMaxInactivityTimeDeviceLock();
79 int setStatus(int status);
82 std::string getPattern();
83 int setMaximumCharacterOccurrences(int value);
84 int getMaximumCharacterOccurrences();
85 int setMaximumNumericSequenceLength(int value);
86 int getMaximumNumericSequenceLength();
87 int setForbiddenStrings(const std::vector<std::string> &forbiddenStrings);
88 std::vector<std::string> getForbiddenStrings();
89 int setRecovery(int enable);
94 std::unique_ptr<Private> pimpl;
97 } /* namespace DevicePolicyManager */
98 #endif /* __PASSWORD_POLICY__ */