java.lang.Object
org.proto4j.redis.sql.SQLPrincipal
- All Implemented Interfaces:
java.nio.file.attribute.UserPrincipal,java.security.Principal,javax.security.auth.Destroyable
public class SQLPrincipal
extends java.lang.Object
implements java.nio.file.attribute.UserPrincipal, javax.security.auth.Destroyable
A user principal identified by a username or account name.
This principal object should be destroyed after successful initiating a new database connection. In order to wipe the stored password from memory.
- Since:
- 1.0
- See Also:
UserPrincipal,Destroyable
-
Constructor Summary
Constructors Constructor Description SQLPrincipal(java.lang.String name, char[] password)Creates a principal. -
Method Summary
Modifier and Type Method Description voiddestroy()Destroy the password of thisSQLPrincipal.booleanequals(java.lang.Object obj)Compares this principal to the specified object.java.lang.StringgetName()Returns the name of this principal.char[]getPassword()Returns the password of this principal.inthashCode()Returns a hash code for this principal.java.lang.StringtoString()Returns a string representation of this principal.
-
Constructor Details
-
SQLPrincipal
public SQLPrincipal(java.lang.String name, char[] password)Creates a principal.- Parameters:
name- The principal's string name.password- The principal's password used for authentication- Throws:
java.lang.NullPointerException- If thenameisnull.
-
-
Method Details
-
getName
public java.lang.String getName()Returns the name of this principal.- Specified by:
getNamein interfacejava.security.Principal- Returns:
- The principal's name.
-
getPassword
public char[] getPassword()Returns the password of this principal.- Returns:
- The principal's password.
-
toString
public java.lang.String toString()Returns a string representation of this principal.- Specified by:
toStringin interfacejava.security.Principal- Overrides:
toStringin classjava.lang.Object- Returns:
- The principal's name.
-
hashCode
public int hashCode()Returns a hash code for this principal.- Specified by:
hashCodein interfacejava.security.Principal- Overrides:
hashCodein classjava.lang.Object- Returns:
- The principal's hash code.
-
equals
public boolean equals(java.lang.Object obj)Compares this principal to the specified object.- Specified by:
equalsin interfacejava.security.Principal- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- The object to compare this principal against.- Returns:
- true if they are equal; false otherwise.
-
destroy
public void destroy()Destroy the password of thisSQLPrincipal.- Specified by:
destroyin interfacejavax.security.auth.Destroyable
-