Class NoOpPasswordEncoder

java.lang.Object
com.codename1.backend.security.crypto.NoOpPasswordEncoder
All Implemented Interfaces:
PasswordEncoder

public final class NoOpPasswordEncoder extends Object implements PasswordEncoder

Stores a password as it is: {noop}secret. For a demonstration or a test, where the point is to read the password in the source.

It verifies only on a development profile. Anywhere else a {noop} password matches nothing and the server says why once on standard error, because a clear-text password that works in production is a configuration left over from a laptop.

  • Method Details

    • getInstance

      public static NoOpPasswordEncoder getInstance()
    • setDevelopmentProfile

      public static void setDevelopmentProfile(boolean value)
      Says whether this process runs on a development profile. The security layer calls it from the configuration it is built with; a test that uses the encoder on its own calls it too.
    • encode

      public String encode(CharSequence rawPassword)
      Description copied from interface: PasswordEncoder
      The password as it should be stored: salted and hashed, so encoding one password twice gives two different results.
      Specified by:
      encode in interface PasswordEncoder
    • matches

      public boolean matches(CharSequence rawPassword, String encodedPassword)
      Description copied from interface: PasswordEncoder
      Whether rawPassword is the password encodedPassword was made from.
      Specified by:
      matches in interface PasswordEncoder