/** * validates the length of the password */ private void validatePasswordLength( String password, PasswordPolicyConfiguration policyConfig ) throws PasswordPolicyException { int maxLen = policyConfig.getPwdMaxLength(); int minLen = policyConfig.getPwdMinLength(); int pwdLen = password.length(); if ( ( maxLen > 0 ) && ( pwdLen > maxLen ) ) { throw new PasswordPolicyException( "Password should not have more than " + maxLen + " characters", INSUFFICIENT_PASSWORD_QUALITY.getValue() ); } if ( ( minLen > 0 ) && ( pwdLen < minLen ) ) { throw new PasswordPolicyException( "Password should have a minimum of " + minLen + " characters", PASSWORD_TOO_SHORT.getValue() ); } }
/** * {@inheritDoc} */ @Override protected void setIntegerValue( int value, Asn1Container container ) { PasswordPolicyContainer ppolicyContainer = ( PasswordPolicyContainer ) container; PasswordPolicyErrorEnum error = PasswordPolicyErrorEnum.get( value ); ppolicyContainer.getPasswordPolicyResponseControl().getResponse().setPasswordPolicyError( error ); ppolicyContainer.setGrammarEndAllowed( true ); } }
/** * {@inheritDoc} */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append( " PasswordPolicyResponse control :\n" ); sb.append( " oid : '" ).append( getOid() ).append( '\n' ); if ( hasResponse() && getResponse().getTimeBeforeExpiration() >= 0 ) { sb.append( " timeBeforeExpiration : '" ).append( getResponse().getTimeBeforeExpiration() ) .append( '\n' ); } else if ( hasResponse() && getResponse().getGraceAuthNRemaining() >= 0 ) { sb.append( " graceAuthNsRemaining : '" ).append( getResponse().getGraceAuthNRemaining() ) .append( '\n' ); } if ( hasResponse() && getResponse().getPasswordPolicyError() != null ) { sb.append( " ppolicyError : '" ).append( getResponse().getPasswordPolicyError().toString() ) .append( '\n' ); } return sb.toString(); }
throw new PasswordPolicyException( "account was permanently locked", ACCOUNT_LOCKED.getValue() ); ACCOUNT_LOCKED.getValue() ); ACCOUNT_LOCKED.getValue() ); ACCOUNT_LOCKED.getValue() ); ACCOUNT_LOCKED.getValue() ); PASSWORD_EXPIRED.getValue() ); throw new PasswordPolicyException( "password expired", PASSWORD_EXPIRED.getValue() );
/** * {@inheritDoc} */ @Override protected void setIntegerValue( int value, Asn1Container container ) { PasswordPolicyContainer ppolicyContainer = ( PasswordPolicyContainer ) container; PasswordPolicyErrorEnum error = PasswordPolicyErrorEnum.get( value ); ppolicyContainer.getPasswordPolicyResponseControl().getResponse().setPasswordPolicyError( error ); ppolicyContainer.setGrammarEndAllowed( true ); } }
/** * {@inheritDoc} */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append( " PasswordPolicyResponse control :\n" ); sb.append( " oid : '" ).append( getOid() ).append( '\n' ); if ( hasResponse() && getResponse().getTimeBeforeExpiration() >= 0 ) { sb.append( " timeBeforeExpiration : '" ).append( getResponse().getTimeBeforeExpiration() ) .append( '\n' ); } else if ( hasResponse() && getResponse().getGraceAuthNRemaining() >= 0 ) { sb.append( " graceAuthNsRemaining : '" ).append( getResponse().getGraceAuthNRemaining() ) .append( '\n' ); } if ( hasResponse() && getResponse().getPasswordPolicyError() != null ) { sb.append( " ppolicyError : '" ).append( getResponse().getPasswordPolicyError().toString() ) .append( '\n' ); } return sb.toString(); }
INSUFFICIENT_PASSWORD_QUALITY.getValue() );
/** * {@inheritDoc} */ @Override protected void setIntegerValue( int value, Asn1Container container ) { PasswordPolicyContainer ppolicyContainer = ( PasswordPolicyContainer ) container; PasswordPolicyErrorEnum error = PasswordPolicyErrorEnum.get( value ); ppolicyContainer.getPasswordPolicyResponseControl().getResponse().setPasswordPolicyError( error ); ppolicyContainer.setGrammarEndAllowed( true ); } }
/** * {@inheritDoc} */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append( " PasswordPolicyResponse control :\n" ); sb.append( " oid : '" ).append( getOid() ).append( '\n' ); if ( hasResponse() && getResponse().getTimeBeforeExpiration() >= 0 ) { sb.append( " timeBeforeExpiration : '" ).append( getResponse().getTimeBeforeExpiration() ) .append( '\n' ); } else if ( hasResponse() && getResponse().getGraceAuthNRemaining() >= 0 ) { sb.append( " graceAuthNsRemaining : '" ).append( getResponse().getGraceAuthNRemaining() ) .append( '\n' ); } if ( hasResponse() && getResponse().getPasswordPolicyError() != null ) { sb.append( " ppolicyError : '" ).append( getResponse().getPasswordPolicyError().toString() ) .append( '\n' ); } return sb.toString(); }
buffer, ( byte ) PasswordPolicyTags.PPOLICY_ERROR_TAG.getValue(), getResponse().getPasswordPolicyError().getValue() );
pwdRespCtrl.getResponse().setPasswordPolicyError( PasswordPolicyErrorEnum.get( ppe.getErrorCode() ) ); bindContext.addResponseControl( pwdRespCtrl );
buffer, ( byte ) PasswordPolicyTags.PPOLICY_ERROR_TAG.getValue(), getResponse().getPasswordPolicyError().getValue() );
new PasswordPolicyDecorator( directoryService.getLdapCodecService(), true ); responseControl.getResponse().setPasswordPolicyError( PasswordPolicyErrorEnum.get( e.getErrorCode() ) ); modifyContext.addResponseControl( responseControl );
buffer, ( byte ) PasswordPolicyTags.PPOLICY_ERROR_TAG.getValue(), getResponse().getPasswordPolicyError().getValue() );
new PasswordPolicyDecorator( directoryService.getLdapCodecService(), true ); responseControl.getResponse().setPasswordPolicyError( PasswordPolicyErrorEnum.get( e.getErrorCode() ) ); addContext.addResponseControl( responseControl );
((PasswordPolicyControl) ctl).setError(PasswordPolicyControl.Error.valueOf(error.getValue()));