Class DecodeBasicAuth

java.lang.Object
com.espacogeek.geek.utils.DecodeBasicAuth

public class DecodeBasicAuth extends Object
Utility class to decode Basic Auth credentials and retrieve a UserModal object.
  • Constructor Details

    • DecodeBasicAuth

      public DecodeBasicAuth(String basicAuth)
      Constructor to initialize the DecodeBasicAuth Util with a Basic Auth string.

      Exemple:

      • username: vitor@gmail.com
      • password: vitor1234
      BasicAuth with Base64 Encode will be something like Basic dml0b3JAZ21haWwuY29tOnZpdG9yMTIzNA==
      Parameters:
      basicAuth - the Basic Auth string to decode
  • Method Details

    • getCredentialsDecoded

      public String[] getCredentialsDecoded()
      Returns the decoded credentials as an array of strings.
      Returns:
      the credentials array
    • getPassword

      public String getPassword()
      get User password from basic auth provide.
      Returns:
      an Optional containing the UserModal object if found, otherwise empty
    • getEmail

      public String getEmail()
      get User email from basic auth provide.
      Returns:
      an Optional containing the UserModal object if found, otherwise empty