directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierre-Arnaud Marcelot ...@marcelot.net>
Subject Re: svn commit: r1094786 - in /directory/apacheds/trunk: server-config/src/main/java/org/apache/directory/server/config/ server-config/src/main/java/org/apache/directory/server/config/beans/ server-config/src/main/resources/ service-builder/src/main/
Date Tue, 19 Apr 2011 11:54:01 GMT
Awesome!

Thanks for the heads up Kiran.

Regards,
Pierre-Arnaud

On 19 avr. 2011, at 11:31, Kiran Ayyagari wrote:

> On Tue, Apr 19, 2011 at 1:03 PM, Pierre-Arnaud Marcelot <pa@marcelot.net> wrote:
>> Hi Kiran,
>> 
>> I'm wondering if the Bean itself should not be renamed from 'PasswordPolicyBean'
to 'PasswordPoliciesBean' to allow the ConfigReader to work.
>> 
>> WDYT?
> we do some magical language processing here to find the singular form
> of a plural word representing the ads-compositeElement AT ;)
> so it works, no need to rename
> thanks for keeping an eye, much appreciated :)
>> 
>> Regards,
>> Pierre-Arnaud
>> 
>> On 18 avr. 2011, at 23:50, kayyagari@apache.org wrote:
>> 
>>> Author: kayyagari
>>> Date: Mon Apr 18 21:50:29 2011
>>> New Revision: 1094786
>>> 
>>> URL: http://svn.apache.org/viewvc?rev=1094786&view=rev
>>> Log:
>>> o added a new container for password policies in config file
>>> o added support for reading multiple password policies
>>> 
>>> Modified:
>>>    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
>>>    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java
>>>    directory/apacheds/trunk/server-config/src/main/resources/config.ldif
>>>    directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
>>> 
>>> Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
>>> URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java?rev=1094786&r1=1094785&r2=1094786&view=diff
>>> ==============================================================================
>>> --- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
(original)
>>> +++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
Mon Apr 18 21:50:29 2011
>>> @@ -573,7 +573,13 @@ public class ConfigPartitionReader
>>>                     {
>>>                         // Try by removing 'es'
>>>                         attributeName = fieldName.substring( 0, fieldName.length()
- 2 );
>>> -
>>> +
>>> +                        // if not found try by removing 'ies' and adding 'y'
, e.x ads-passwordPolicies
>>> +                        if ( fieldName.endsWith( "ies" ) && !schemaManager.getObjectClassRegistry().contains(
attributeName ) )
>>> +                        {
>>> +                            attributeName = fieldName.substring( 0, fieldName.length()
- 3 ) + "y";
>>> +                        }
>>> +
>>>                         if ( !schemaManager.getObjectClassRegistry().contains(
attributeName ) )
>>>                         {
>>>                             String message = "Cannot find the ObjectClass named
" + attributeName + " in the schema";
>>> 
>>> Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java
>>> URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java?rev=1094786&r1=1094785&r2=1094786&view=diff
>>> ==============================================================================
>>> --- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java
(original)
>>> +++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java
Mon Apr 18 21:50:29 2011
>>> @@ -90,8 +90,8 @@ public class DirectoryServiceBean extend
>>>     private List<PartitionBean> partitions = new ArrayList<PartitionBean>();
>>> 
>>>     /** The reference to the Password Policy component */
>>> -    @ConfigurationElement
>>> -    private PasswordPolicyBean passwordPolicy;
>>> +    @ConfigurationElement(attributeType = "ads-passwordPolicies", container
= "passwordPolicies")
>>> +    private List<PasswordPolicyBean> passwordPolicies = new ArrayList<PasswordPolicyBean>();
>>> 
>>> 
>>>     /**
>>> @@ -524,24 +524,36 @@ public class DirectoryServiceBean extend
>>> 
>>> 
>>>     /**
>>> -     * @return the passwordPolicy
>>> +     * @return the passwordPolicies
>>>      */
>>> -    public PasswordPolicyBean getPasswordPolicy()
>>> +    public List<PasswordPolicyBean> getPasswordPolicies()
>>>     {
>>> -        return passwordPolicy;
>>> +        return passwordPolicies;
>>>     }
>>> 
>>> 
>>>     /**
>>> -     * @param passwordPolicy the passwordPolicy to set
>>> +     * @param passwordPolicies the pwdPolicies to set
>>>      */
>>> -    public void setPasswordPolicy( PasswordPolicyBean passwordPolicy )
>>> +    public void setPasswordPolicies( List<PasswordPolicyBean> passwordPolicies
)
>>>     {
>>> -        this.passwordPolicy = passwordPolicy;
>>> +        this.passwordPolicies = passwordPolicies;
>>>     }
>>> 
>>> 
>>>     /**
>>> +     * @param ppolicies the password policies to add
>>> +     */
>>> +    public void addPasswordPolicies( PasswordPolicyBean... ppolicies )
>>> +    {
>>> +        for ( PasswordPolicyBean ppolicy : ppolicies )
>>> +        {
>>> +            this.passwordPolicies.add( ppolicy );
>>> +        }
>>> +    }
>>> +
>>> +
>>> +    /**
>>>      * {@inheritDoc}
>>>      */
>>>     public String toString()
>>> @@ -592,9 +604,12 @@ public class DirectoryServiceBean extend
>>>             sb.append( changeLog.toString( "  " ) );
>>>         }
>>> 
>>> -        if ( passwordPolicy != null )
>>> +        if ( ( passwordPolicies != null ) && ( passwordPolicies.size()
> 0 ) )
>>>         {
>>> -            sb.append( passwordPolicy.toString( "  " ) );
>>> +            for ( PasswordPolicyBean ppolicy : passwordPolicies )
>>> +            {
>>> +                sb.append( ppolicy.toString( "    " ) );
>>> +            }
>>>         }
>>> 
>>>         sb.append( "  servers : \n" );
>>> 
>>> Modified: directory/apacheds/trunk/server-config/src/main/resources/config.ldif
>>> URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/resources/config.ldif?rev=1094786&r1=1094785&r2=1094786&view=diff
>>> ==============================================================================
>>> --- directory/apacheds/trunk/server-config/src/main/resources/config.ldif (original)
>>> +++ directory/apacheds/trunk/server-config/src/main/resources/config.ldif Mon
Apr 18 21:50:29 2011
>>> @@ -23,6 +23,7 @@ ads-servers: ldapServer
>>> ads-servers: ntpServer
>>> ads-partitions: example
>>> ads-partitions: system
>>> +ads-passwordPolicies: default
>>> ads-interceptors: aciAuthorizationInterceptor
>>> ads-interceptors: authenticationInterceptor
>>> ads-interceptors: collectiveAttributeInterceptor
>>> @@ -216,11 +217,16 @@ ads-interceptorclassname: org.apache.dir
>>> ads-interceptorid: triggerInterceptor
>>> ads-enabled: TRUE
>>> 
>>> -dn: ads-pwdId=pwdPolicy,ads-directoryServiceId=default,ou=config
>>> +dn: ou=passwordPolicies,ads-directoryServiceId=default,ou=config
>>> +objectClass: organizationalUnit
>>> +objectClass: top
>>> +ou: passwordPolicies
>>> +
>>> +dn: ads-pwdId=default,ou=passwordPolicies,ads-directoryServiceId=default,ou=config
>>> objectClass: top
>>> objectClass: ads-base
>>> objectClass: ads-passwordPolicy
>>> -ads-pwdId: pwdPolicy
>>> +ads-pwdId: default
>>> ads-pwdSafeModify: FALSE
>>> ads-pwdMaxAge: 0
>>> ads-pwdFailureCountInterval: 30
>>> 
>>> Modified: directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
>>> URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java?rev=1094786&r1=1094785&r2=1094786&view=diff
>>> ==============================================================================
>>> --- directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
(original)
>>> +++ directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
Mon Apr 18 21:50:29 2011
>>> @@ -1270,16 +1270,30 @@ public class ServiceBuilder
>>>             directoryService.setJournal( jl );
>>>         }
>>> 
>>> -        // password policy
>>> -        // TODO add support for reading multiple policies from the config
>>> -        PasswordPolicyConfiguration pPolicyConfig = createPwdPolicyConfig( directoryServiceBean.getPasswordPolicy()
);
>>> -        if ( pPolicyConfig != null )
>>> +        // password policies
>>> +        List<PasswordPolicyBean> ppolicyBeans = directoryServiceBean.getPasswordPolicies();
>>> +        PpolicyConfigContainer ppolicyContainer = new  PpolicyConfigContainer();
>>> +
>>> +        for ( PasswordPolicyBean ppolicyBean : ppolicyBeans )
>>>         {
>>> -            PpolicyConfigContainer pPolicies = new  PpolicyConfigContainer();
>>> -            pPolicies.setDefaultPolicy( pPolicyConfig );
>>> -            directoryService.setPwdPolicies( pPolicies );
>>> +            PasswordPolicyConfiguration ppolicyConfig = createPwdPolicyConfig(
ppolicyBean );
>>> +
>>> +            if ( ppolicyConfig != null )
>>> +            {
>>> +                // the name should be strictly 'default', the default policy
can't be enforced by defining a new AT
>>> +                if ( ppolicyBean.getPwdId().equalsIgnoreCase( "default" ) )
>>> +                {
>>> +                    ppolicyContainer.setDefaultPolicy( ppolicyConfig );
>>> +                }
>>> +                else
>>> +                {
>>> +                    ppolicyContainer.addPolicy( ppolicyBean.getDn(), ppolicyConfig
);
>>> +                }
>>> +            }
>>>         }
>>> 
>>> +        directoryService.setPwdPolicies( ppolicyContainer );
>>> +
>>>         // MaxPDUSize
>>>         directoryService.setMaxPDUSize( directoryServiceBean.getDsMaxPDUSize()
);
>>> 
>>> 
>>> 
>> 
>> 
> 
> 
> 
> -- 
> Kiran Ayyagari


Mime
View raw message