Package com.espacogeek.geek.utils
Class DecodeBasicAuth
java.lang.Object
com.espacogeek.geek.utils.DecodeBasicAuth
Utility class to decode Basic Auth credentials and retrieve a UserModal object.
-
Constructor Summary
ConstructorsConstructorDescriptionDecodeBasicAuth(String basicAuth) Constructor to initialize the DecodeBasicAuth Util with a Basic Auth string. -
Method Summary
-
Constructor Details
-
DecodeBasicAuth
Constructor to initialize the DecodeBasicAuth Util with a Basic Auth string.Exemple:
- username: vitor@gmail.com
- password: vitor1234
Basic dml0b3JAZ21haWwuY29tOnZpdG9yMTIzNA==- Parameters:
basicAuth- the Basic Auth string to decode
-
-
Method Details
-
getCredentialsDecoded
Returns the decoded credentials as an array of strings.- Returns:
- the credentials array
-
getPassword
get User password from basic auth provide.- Returns:
- an Optional containing the UserModal object if found, otherwise empty
-
getEmail
get User email from basic auth provide.- Returns:
- an Optional containing the UserModal object if found, otherwise empty
-