Class SecretProvider

  • All Implemented Interfaces:

    
    public class SecretProvider
    
                        

    System password provider, default 256bit, 32 characters

    Since:

    2022-12-05

    Author:

    trydofor

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static String strong(int len) Generate `len` length passwords of alphabetic, case-sensitive and numeric
      static String human(int len) Generate `len` length passwords with good readability of case-sensitive letters and numbers.
      static String get(String name) Get the secret by name, if not found, generate a default length strong password and cache it.
      static String get(String name, boolean computeIfAbsent) Get the secret by name, if not found and computeIfAbsent, generate a default length strong password and cache it.
      String tryGet(String name) used for `@Bean` method
      static void put(@NotNull() String name, @NotNull() String secret, boolean replace) put the secret by name
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • strong

        @NotNull() static String strong(int len)

        Generate `len` length passwords of alphabetic, case-sensitive and numeric

      • human

        @NotNull() static String human(int len)

        Generate `len` length passwords with good readability of case-sensitive letters and numbers. total 32 Letter and Numbers, removing 30 (0oO,1il,cC,j,kK,mM,nN,pP,sS,uU,vV,wW,xX,y,zZ)

      • get

        @NotNull() static String get(String name)

        Get the secret by name, if not found, generate a default length strong password and cache it.

      • get

        @Contract(value = "_,true->!null") static String get(String name, boolean computeIfAbsent)

        Get the secret by name, if not found and computeIfAbsent, generate a default length strong password and cache it.

      • put

         static void put(@NotNull() String name, @NotNull() String secret, boolean replace)

        put the secret by name