Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) 2014 Philip Helger (www.helger.com) philip[at]helger[dot]com Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package com.helger.appbasics.security.password.constraint;
This interface defines a list of password constraints.

Author(s):
Philip Helger
{
  

Returns:
true if at least one constraint is present
  boolean hasConstraints ();

  

Returns:
The number of contained constraints. Always ≥ 0.
  int getConstraintCount ();

  

Returns:
A list of all contained password constraints. Never null.
Check if the passed plaintext password is valid. Breaks after the first unfulfilled constrained

Parameters:
sPlainTextPassword The password to check. May be null.
Returns:
true if no constraint was unfulfilled (meaning that if no constrained is defined, every password is valid).
  boolean isPasswordValid (@Nullable String sPlainTextPassword);

  
Check if the passed password is valid. The descriptions of all failed constraints are returned.

Parameters:
sPlainTextPassword The password to check. May be null.
aContentLocale The content locale to be used to determine the descriptions.
Returns:
A non-null but empty list if no constraint was unfulfilled (meaning that if no constrained is defined, every password is valid). If the returned list is not empty than the password is invalid.
  List <StringgetInvalidPasswordDescriptions (@Nullable String sPlainTextPassword, @Nonnull Locale aContentLocale);

  
Get a list of all password constraint descriptions in the specified locale (e.g. for hinting a user)

Parameters:
aContentLocale The locale to be used for text resolving.
Returns:
A non-null list with all constraint descriptions. If the returned list is empty, it means that no constraint is defined.
New to GrepCode? Check out our FAQ X