Class UserCredentials
java.lang.Object
org.gcube.documentstore.security.credentials.UserCredentials
- All Implemented Interfaces:
org.gcube.common.security.credentials.Credentials,DocumentStoreCredential
The
UserCredentials class implements the Credentials
interface
and represents user credentials with a username and password.
This class ensures that both username and password are not null or empty
using the @NotNull and @NotEmpty annotations.
It provides getter and setter methods for the username and password fields,
and overrides the hashCode, equals, and toString
methods
from the Object class.
The equals method compares the current object with another object
to check for equality based on the username and password fields.
The hashCode method generates a hash code for the object based on
the username and password fields.
The toString method returns a string representation of the object,
including the class name and the values of the username and password fields.
Example usage:
UserCredentials credentials = new UserCredentials();
credentials.setUsername("user123");
credentials.setPassword("pass123");
- Author:
- Luca
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static StringconstructBasicAuthenticationHeader(String clientId, String clientSecret) booleangetContexts(org.gcube.common.keycloak.KeycloakClient client, String endpoint) org.gcube.common.security.secrets.SecretgetSecretForContext(org.gcube.common.keycloak.KeycloakClient client, String endpoint, String context) inthashCode()voidsetPassword(String secret) voidsetUsername(String clientID) toString()
-
Constructor Details
-
UserCredentials
public UserCredentials()
-
-
Method Details
-
getUsername
-
setUsername
-
getPassword
-
setPassword
-
hashCode
public int hashCode() -
equals
-
toString
-
getContexts
- Specified by:
getContextsin interfaceDocumentStoreCredential
-
constructBasicAuthenticationHeader
-
getSecretForContext
public org.gcube.common.security.secrets.Secret getSecretForContext(org.gcube.common.keycloak.KeycloakClient client, String endpoint, String context) - Specified by:
getSecretForContextin interfaceDocumentStoreCredential
-