/** * Convert from java date {@link java.util.Date} format to raw ldap generalized time format. * to encode the string. * * @param date reference to standard java date. * @return converted to standardized ldap generalized time format. */ public static String encodeGeneralizedTime(java.util.Date date) { String szTime; szTime = DateUtils.getGeneralizedTime( date ); return szTime; } }
/** * checks if the given password's change time is older than the max age * * @param pwdChangedZtime time when the password was last changed * @param pwdMaxAgeSec the max age value in seconds * @return true if expired, false otherwise */ public static boolean isPwdExpired( String pwdChangedZtime, int pwdMaxAgeSec ) { Date pwdChangeDate = DateUtils.getDate( pwdChangedZtime ); //DIRSERVER-1735 long time = pwdMaxAgeSec * 1000L; time += pwdChangeDate.getTime(); Date expiryDate = DateUtils.getDate( DateUtils.getGeneralizedTime( time ) ); Date now = DateUtils.getDate( DateUtils.getGeneralizedTime() ); boolean expired = false; if ( expiryDate.equals( now ) || expiryDate.before( now ) ) { expired = true; } return expired; }
/** * Convert from raw ldap generalized time format to {@link java.util.Date}. * to decode the string. * * @param inputString containing raw ldap generalized time formatted string. * @return converted to {@link java.util.Date}. */ public static java.util.Date decodeGeneralizedTime(String inputString) throws ParseException { java.util.Date aDate; aDate = DateUtils.getDate( inputString ); return aDate; }
/** * * @see #getGeneralizedTime() * * @param time the time value to be converted to generalized time string * @return given time in generalized time string format */ public static String getGeneralizedTime( long time ) { return getGeneralizedTime( new Date( time ) ); }
/** * checks if the given password's change time is older than the max age * * @param pwdChangedZtime time when the password was last changed * @param pwdMaxAgeSec the max age value in seconds * @return true if expired, false otherwise */ public static boolean isPwdExpired( String pwdChangedZtime, int pwdMaxAgeSec ) { Date pwdChangeDate = DateUtils.getDate( pwdChangedZtime ); //DIRSERVER-1735 long time = pwdMaxAgeSec * 1000L; time += pwdChangeDate.getTime(); Date expiryDate = DateUtils.getDate( DateUtils.getGeneralizedTime( time ) ); Date now = DateUtils.getDate( DateUtils.getGeneralizedTime() ); boolean expired = false; if ( expiryDate.equals( now ) || expiryDate.before( now ) ) { expired = true; } return expired; }
/** * * @see #getGeneralizedTime() * * @param time the time value to be converted to generalized time string * @return given time in generalized time string format */ public static String getGeneralizedTime( long time ) { return getGeneralizedTime( new Date( time ) ); }
/** * checks if the given password's change time is older than the max age * * @param pwdChangedZtime time when the password was last changed * @param pwdMaxAgeSec the max age value in seconds * @return true if expired, false otherwise */ public static boolean isPwdExpired( String pwdChangedZtime, int pwdMaxAgeSec ) { Date pwdChangeDate = DateUtils.getDate( pwdChangedZtime ); //DIRSERVER-1735 long time = pwdMaxAgeSec * 1000L; time += pwdChangeDate.getTime(); Date expiryDate = DateUtils.getDate( DateUtils.getGeneralizedTime( time ) ); Date now = DateUtils.getDate( DateUtils.getGeneralizedTime() ); boolean expired = false; if ( expiryDate.equals( now ) || expiryDate.before( now ) ) { expired = true; } return expired; }
/** * {@inheritDoc} */ @Override public ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, LdifEntry reverse ) { currentRevision++; ChangeLogEvent event = new ChangeLogEvent( currentRevision, DateUtils.getGeneralizedTime(), principal, forward, reverse ); events.add( event ); return event; }
long currentTime = DateUtils.getDate( DateUtils.getGeneralizedTime() ).getTime(); long time = DateUtils.getDate( failureTime ).getTime(); time += interval;
/** * {@inheritDoc} */ @Override public ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, List<LdifEntry> reverses ) { currentRevision++; ChangeLogEvent event = new ChangeLogEvent( currentRevision, DateUtils.getGeneralizedTime(), principal, forward, reverses ); events.add( event ); return event; }
long changedTime = DateUtils.getDate( pwdChangedTimeAt.getString() ).getTime(); changedTime += policyConfig.getPwdMinAge() * 1000L; long currentTime = DateUtils.getDate( DateUtils.getGeneralizedTime() ).getTime();
/** * Convert a Normalizer instance into an Entry * * @param oid The Normalizer's OID * @param normalizer The Normalizer to convert * @param schema The schema containing this Normalizer * @param schemaManager The SchemaManager * @return An Entry defining a Normalizer */ public Entry convert( String oid, Normalizer normalizer, Schema schema, SchemaManager schemaManager ) { Entry entry = new DefaultEntry( schemaManager ); entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, MetaSchemaConstants.META_NORMALIZER_OC ); entry.put( MetaSchemaConstants.M_OID_AT, oid ); entry.put( MetaSchemaConstants.M_FQCN_AT, normalizer.getClass().getName() ); entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() ); entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ); return entry; }
long changedTime = DateUtils.getDate( pwdChangedTimeAt.getString() ).getTime(); long currentTime = DateUtils.getDate( DateUtils.getGeneralizedTime() ).getTime(); long pwdAge = ( currentTime - changedTime ) / 1000;
/** * Convert a LdapComparator instance into an Entry * * @param oid The LdapComparator's OID * @param comparator The LdapComparator to convert * @param schema The schema containing this Comparator * @param schemaManager The SchemaManager * @return An Entry defining a LdapComparator */ public Entry convert( String oid, LdapComparator<? super Object> comparator, Schema schema, SchemaManager schemaManager ) { Entry entry = new DefaultEntry( schemaManager ); entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, MetaSchemaConstants.META_COMPARATOR_OC ); entry.put( MetaSchemaConstants.M_OID_AT, oid ); entry.put( MetaSchemaConstants.M_FQCN_AT, comparator.getClass().getName() ); entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() ); entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ); return entry; }
long now = DateUtils.getDate( DateUtils.getGeneralizedTime() ).getTime();
/** * Convert a LdapComparator instance into an Entry * * @param oid The LdapComparator's OID * @param comparator The LdapComparator to convert * @param schema The schema containing this Comparator * @param schemaManager The SchemaManager * @return An Entry defining a LdapComparator */ public Entry convert( String oid, LdapComparator<? super Object> comparator, Schema schema, SchemaManager schemaManager ) { Entry entry = new DefaultEntry( schemaManager ); entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, MetaSchemaConstants.META_COMPARATOR_OC ); entry.put( MetaSchemaConstants.M_OID_AT, oid ); entry.put( MetaSchemaConstants.M_FQCN_AT, comparator.getClass().getName() ); entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() ); entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ); return entry; }
Date lockedDate = DateUtils.getDate( lockedTime ); long unlockTime = pPolicyConfig.getPwdLockoutDuration() * 1000L; unlockTime += lockedDate.getTime(); Date now = DateUtils.getDate( DateUtils.getGeneralizedTime() ); Date pwdStartTime = DateUtils.getDate( pwdStartTimeAttr.getString() ); Date pwdEndTime = DateUtils.getDate( pwdEndTimeAttr.getString() ); time += DateUtils.getDate( pwdLastSuccessTimeAttr.getString() ).getTime();
/** * Convert a Normalizer instance into an Entry * * @param oid The Normalizer's OID * @param normalizer The Normalizer to convert * @param schema The schema containing this Normalizer * @param schemaManager The SchemaManager * @return An Entry defining a Normalizer */ public Entry convert( String oid, Normalizer normalizer, Schema schema, SchemaManager schemaManager ) { Entry entry = new DefaultEntry( schemaManager ); entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, MetaSchemaConstants.META_NORMALIZER_OC ); entry.put( MetaSchemaConstants.M_OID_AT, oid ); entry.put( MetaSchemaConstants.M_FQCN_AT, normalizer.getClass().getName() ); entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() ); entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ); return entry; }
/** * Convert a Normalizer instance into an Entry * * @param oid The Normalizer's OID * @param normalizer The Normalizer to convert * @param schema The schema containing this Normalizer * @param schemaManager The SchemaManager * @return An Entry defining a Normalizer */ public Entry convert( String oid, Normalizer normalizer, Schema schema, SchemaManager schemaManager ) { Entry entry = new DefaultEntry( schemaManager ); entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, MetaSchemaConstants.META_NORMALIZER_OC ); entry.put( MetaSchemaConstants.M_OID_AT, oid ); entry.put( MetaSchemaConstants.M_FQCN_AT, normalizer.getClass().getName() ); entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() ); entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ); return entry; }
/** * Convert a LdapComparator instance into an Entry * * @param oid The LdapComparator's OID * @param comparator The LdapComparator to convert * @param schema The schema containing this Comparator * @param schemaManager The SchemaManager * @return An Entry defining a LdapComparator */ public Entry convert( String oid, LdapComparator<? super Object> comparator, Schema schema, SchemaManager schemaManager ) { Entry entry = new DefaultEntry( schemaManager ); entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, MetaSchemaConstants.META_COMPARATOR_OC ); entry.put( MetaSchemaConstants.M_OID_AT, oid ); entry.put( MetaSchemaConstants.M_FQCN_AT, comparator.getClass().getName() ); entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() ); entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ); return entry; }