f35d323ca29270b6c2b0a319050a0941af697c97
[platform/core/security/suspicious-activity-monitor.git] / dpm-tm1 / policy / password.hxx
1 /*
2  *  Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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
15  */
16
17 #ifndef __PASSWORD_POLICY__
18 #define __PASSWORD_POLICY__
19
20 #include "policy-context.hxx"
21
22 namespace DevicePolicyManager {
23
24 class PasswordPolicy {
25 public:
26         typedef enum {
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;
34
35         typedef enum {
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*/
41
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 */
45
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;
52
53         PasswordPolicy(PolicyControlContext &ctxt);
54         ~PasswordPolicy();
55
56         PasswordPolicy(const PasswordPolicy& rhs);
57         PasswordPolicy(PasswordPolicy&& rhs);
58
59         PasswordPolicy& operator=(const PasswordPolicy& rhs);
60         PasswordPolicy& operator=(PasswordPolicy&& rhs);
61
62         int setQuality(int quality);
63         int getQuality();
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);
71         int getExpires();
72         int setHistory(int value);
73         int getHistory();
74         int setPattern(const std::string &pattern);
75         int reset(const std::string &passwd);
76         int enforceChange();
77         int setMaxInactivityTimeDeviceLock(int value);
78         int getMaxInactivityTimeDeviceLock();
79         int setStatus(int status);
80         int getStatus();
81         int deletePattern();
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);
90         int getRecovery();
91
92 private:
93         struct Private;
94         std::unique_ptr<Private> pimpl;
95 };
96
97 } /* namespace DevicePolicyManager */
98 #endif /* __PASSWORD_POLICY__ */