View Javadoc
1   /*
2    *   Licensed to the Apache Software Foundation (ASF) under one
3    *   or more contributor license agreements.  See the NOTICE file
4    *   distributed with this work for additional information
5    *   regarding copyright ownership.  The ASF licenses this file
6    *   to you under the Apache License, Version 2.0 (the
7    *   "License"); you may not use this file except in compliance
8    *   with the License.  You may obtain a copy of the License at
9    *
10   *     https://www.apache.org/licenses/LICENSE-2.0
11   *
12   *   Unless required by applicable law or agreed to in writing,
13   *   software distributed under the License is distributed on an
14   *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *   KIND, either express or implied.  See the License for the
16   *   specific language governing permissions and limitations
17   *   under the License.
18   *
19   */
20  package org.apache.directory.api.ldap.extras.controls.ppolicy;
21  
22  import org.apache.directory.api.ldap.model.message.Control;
23  
24  /**
25   * The PasswordPolicy response. It contains information about the error if we
26   * had one when injecting a bad password into the server. Here is the controlValue
27   * ASN.1 grammar:
28   * <pre>
29   * PasswordPolicyResponseValue ::= SEQUENCE {
30   *       warning [0] CHOICE {
31   *          timeBeforeExpiration [0] INTEGER (0 .. maxInt),
32   *          graceAuthNsRemaining [1] INTEGER (0 .. maxInt) 
33   *       } OPTIONAL,
34   *       error   [1] ENUMERATED {
35   *          passwordExpired             (0),
36   *          accountLocked               (1),
37   *          changeAfterReset            (2),
38   *          passwordModNotAllowed       (3),
39   *          mustSupplyOldPassword       (4),
40   *          insufficientPasswordQuality (5),
41   *          passwordTooShort            (6),
42   *          passwordTooYoung            (7),
43   *          passwordInHistory           (8) } OPTIONAL 
44   *       }
45   * }
46   * </pre>
47   * 
48   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
49   * @version $Rev$, $Date$
50   */
51  public interface PasswordPolicyResponse extends Control
52  {
53      /** the password policy response control */
54      String OID = "1.3.6.1.4.1.42.2.27.8.5.1";
55  
56      /**
57       * Returns the time before expiration.  Will return -1 if this warning 
58       * was not present in the response.
59       * 
60       * @return The time before expiration of the password, or -1 if not set
61       */
62      int getTimeBeforeExpiration();
63  
64  
65      /**
66       * Set a date of expiration for the password.
67       * 
68       * @param timeBeforeExpiration The time before the password will expire
69       */
70      void setTimeBeforeExpiration( int timeBeforeExpiration );
71  
72  
73      /**
74       * Returns the number of possible attempts on the password before it's 
75       * locked.  Will return -1 if this warning was not present in the 
76       * response.
77       * 
78       * @return The number of possible attempts on the password before it's locked
79       */
80      int getGraceAuthNRemaining();
81  
82  
83      /**
84       * Sets the number of remaining wrong authentication for this password.
85       * 
86       * @param graceAuthNRemaining The number of remaining attempts
87       */
88      void setGraceAuthNRemaining( int graceAuthNRemaining );
89  
90  
91      /**
92       * Returns the password policy error.
93       * 
94       * @return The PasswordPolicyErrorEnum representing the error
95       */
96      PasswordPolicyErrorEnum getPasswordPolicyError();
97  
98  
99      /**
100      * Sets the PasswordPolicy error.
101      * 
102      * @param ppolicyError The PasswordPolicyErrorEnum representing the error
103      */
104     void setPasswordPolicyError( PasswordPolicyErrorEnum ppolicyError );
105 }