PasswordExpirationTimeVirtualAttributeProvider.java revision 1213c76646ee52dee5230cb219a7af951e8433b9
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at
* trunk/opends/resource/legal-notices/CDDLv1_0.txt. If applicable,
* add the following below this CDDL HEADER, with the fields enclosed
* by brackets "[]" replaced with your own identifying information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2012 profiq s.r.o.
* Portions Copyright 2012 ForgeRock AS
*/
import
/**
* Provider for the password expiration time virtual attribute.
*/
public class PasswordExpirationTimeVirtualAttributeProvider
{
/**
* Debug tracer to log debugging information.
*/
/**
* Default constructor.
*/
{
super();
}
/**
* {@inheritDoc}
*/
public void
{
// No initialization needed
}
/**
* {@inheritDoc}
*/
public boolean isMultiValued()
{
return false;
}
/**
* {@inheritDoc}
*/
{
// Do not process LDAP operational entries.
{
if (expirationTime == -1)
{
// It does not expire.
return Collections.emptySet();
}
}
return Collections.emptySet();
}
/**
* {@inheritDoc}
*/
boolean isPreIndexed)
{
return false;
}
/**
* {@inheritDoc}
*/
{
}
/**
* {@inheritDoc}
*/
{
// Do not process LDAP operational entries.
{
return false;
}
return true;
}
/**
* Utility method to wrap the PasswordPolicyState.getExpirationTime().
*
* @param entry LDAP entry
* @return Expiration time in milliseconds since the epoch.
*/
{
// Do not process LDAP operational entries.
try
{
}
catch (DirectoryException de)
{
if (debugEnabled())
{
"policy for user %s: %s",
}
}
{
// No authentication policy: debug log this as an error since all
// entries should have at least the default password policy.
if (debugEnabled())
{
}
}
else if (policy.isPasswordPolicy())
{
try
{
pwpState =
}
catch (DirectoryException de)
{
if (debugEnabled())
{
"policy state for user %s: %s",
}
}
return pwpState.getPasswordExpirationTime();
}
else
{
// Not a password policy, could be PTA, etc.
if (debugEnabled())
{
}
}
return -1L;
}
}