Skip to content

Commit 1e696e1

Browse files
committed
ppolicy doc
1 parent 5138dd0 commit 1e696e1

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

Doc/reference/ldap-controls.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,16 @@ search.
206206

207207
.. autoclass:: ldap.controls.readentry.PostReadControl
208208
:members:
209+
210+
211+
:py:mod:`ldap.controls.ppolicy` Password Policy Control
212+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
213+
214+
.. seealso::
215+
`draft-behera-ldap-password-policy <https://tools.ietf.org/html/draft-behera-ldap-password-policy>`_
216+
217+
.. py:module:: ldap.controls.ppolicy
218+
:synopsis: passworld policies
219+
220+
.. autoclass:: ldap.controls.ppolicy.PasswordPolicyControl
221+
:members:

Lib/ldap/controls/ppolicy.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,25 @@ class PasswordPolicyResponseValue(univ.Sequence):
6262

6363

6464
class PasswordPolicyControl(ValueLessRequestControl,ResponseControl):
65+
"""
66+
Indicates the errors and warnings about the password policy.
67+
"""
6568
controlType = '1.3.6.1.4.1.42.2.27.8.5.1'
6669

6770
def __init__(self,criticality=False):
6871
self.criticality = criticality
6972

70-
def decodeControlValue(self,encodedControlValue):
71-
ppolicyValue,_ = decoder.decode(encodedControlValue,asn1Spec=PasswordPolicyResponseValue())
7273
self.timeBeforeExpiration = None
74+
"""The time before the password expires."""
75+
7376
self.graceAuthNsRemaining = None
77+
"""The number of grace authentications remaining."""
78+
7479
self.error = None
80+
"""The password and authentication errors."""
7581

82+
def decodeControlValue(self,encodedControlValue):
83+
ppolicyValue,_ = decoder.decode(encodedControlValue,asn1Spec=PasswordPolicyResponseValue())
7684
warning = ppolicyValue.getComponentByName('warning')
7785
if warning.hasValue():
7886
if 'timeBeforeExpiration' in warning:

0 commit comments

Comments
 (0)