Package eu.webtoolkit.jwt.auth.jpa
Class AuthInfo
java.lang.Object
eu.webtoolkit.jwt.auth.jpa.AuthInfo
public class AuthInfo
extends java.lang.Object
A default JPA implementation for authentication data
This class implements the requirements for use as a data type in
The auth1 feature example contains an example mapping file (examples/feature/auth1/src/META-INF/orm.xml), and a Postgres schema file (examples/feature/auth1/src/META-INF/schema.postgres.sql).
To add extra fields to a user's profile you need to extend
UserDatabase
.
-
It contains collections to two other types:
-
getAuthTokens()
references a collection of authentication tokens (seeAuthService.setAuthTokensEnabled(boolean enabled)
) -
getAuthIdentities()
references a collection of identities, which represent all the authentication identities this user has (e.g. a login name, but also an OAuth identity, etc...)
The auth1 feature example contains an example mapping file (examples/feature/auth1/src/META-INF/orm.xml), and a Postgres schema file (examples/feature/auth1/src/META-INF/schema.postgres.sql).
To add extra fields to a user's profile you need to extend
AbstractUser
.- See Also:
UserDatabase
-
Constructor Summary
Constructors Constructor Description AuthInfo()
-
Method Summary
Modifier and Type Method Description java.util.List<AuthIdentity>
getAuthIdentities()
Returns the authentication identities.java.util.List<AuthToken>
getAuthTokens()
Returns the authentication tokens.java.lang.String
getEmail()
Returns the email address.java.lang.String
getEmailToken()
Returns the email token.java.util.Date
getEmailTokenExpires()
Returns the email token expiration date.User.EmailTokenRole
getEmailTokenRole()
Returns the email token role.int
getFailedLoginAttempts()
Returns the number of failed login attempts.long
getId()
java.util.Date
getLastLoginAttempt()
Returns the time of the last login attempt.java.lang.String
getPasswordHash()
Returns the password hash.java.lang.String
getPasswordMethod()
Returns the password method.java.lang.String
getPasswordSalt()
Returns the password salt.User.Status
getStatus()
Returns the status.java.lang.String
getUnverifiedEmail()
Returns the unverified email address.AbstractUser
getUser()
Returns a reference to the user.int
getVersion()
void
setAuthIdentities(java.util.List<AuthIdentity> authIdentities)
void
setAuthTokens(java.util.List<AuthToken> authTokens)
void
setEmail(java.lang.String email)
Sets the email address.void
setEmailToken(java.lang.String emailToken)
void
setEmailToken(java.lang.String hash, java.util.Date expires, User.EmailTokenRole role)
Sets the email token.void
setEmailTokenExpires(java.util.Date emailTokenExpires)
void
setEmailTokenRole(User.EmailTokenRole emailTokenRole)
void
setFailedLoginAttempts(int count)
Sets the number of failed login attempts.void
setId(long id)
void
setLastLoginAttempt(java.util.Date dt)
Sets the time of the last login attempt.void
setPassword(java.lang.String hash, java.lang.String hashFunction, java.lang.String hashSalt)
Sets a password.void
setPasswordHash(java.lang.String passwordHash)
void
setPasswordMethod(java.lang.String passwordMethod)
void
setPasswordSalt(java.lang.String passwordSalt)
void
setStatus(User.Status status)
Sets the status.void
setUnverifiedEmail(java.lang.String email)
Sets the unverified email address.void
setUser(AbstractUser user)
Sets the user.void
setVersion(int version)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
AuthInfo
public AuthInfo()
-
-
Method Details
-
setUser
Sets the user. This sets the user that owns this authentication information.AbstractUser
is an empty class by default, you can extend it to add extra field (e.g.: First name, Last name, ...). -
getUser
Returns a reference to the user.- See Also:
setUser(AbstractUser user)
-
setPassword
public void setPassword(java.lang.String hash, java.lang.String hashFunction, java.lang.String hashSalt)Sets a password. -
getPasswordHash
public java.lang.String getPasswordHash()Returns the password hash. -
setPasswordHash
public void setPasswordHash(java.lang.String passwordHash) -
getPasswordMethod
public java.lang.String getPasswordMethod()Returns the password method. -
setPasswordMethod
public void setPasswordMethod(java.lang.String passwordMethod) -
getPasswordSalt
public java.lang.String getPasswordSalt()Returns the password salt. -
setPasswordSalt
public void setPasswordSalt(java.lang.String passwordSalt) -
setEmail
public void setEmail(java.lang.String email)Sets the email address. -
getEmail
public java.lang.String getEmail()Returns the email address.- See Also:
setEmail(String email)
-
setUnverifiedEmail
public void setUnverifiedEmail(java.lang.String email)Sets the unverified email address. -
getUnverifiedEmail
public java.lang.String getUnverifiedEmail()Returns the unverified email address.- See Also:
setUnverifiedEmail(String email)
-
setEmailToken
Sets the email token. -
getEmailToken
public java.lang.String getEmailToken()Returns the email token. -
setEmailToken
public void setEmailToken(java.lang.String emailToken) -
getEmailTokenExpires
public java.util.Date getEmailTokenExpires()Returns the email token expiration date. -
setEmailTokenExpires
public void setEmailTokenExpires(java.util.Date emailTokenExpires) -
getEmailTokenRole
Returns the email token role. -
setEmailTokenRole
-
setStatus
Sets the status. -
getStatus
Returns the status.- See Also:
setStatus(User.Status status)
-
setFailedLoginAttempts
public void setFailedLoginAttempts(int count)Sets the number of failed login attempts. -
getFailedLoginAttempts
public int getFailedLoginAttempts()Returns the number of failed login attempts.- See Also:
setFailedLoginAttempts(int count)
-
setLastLoginAttempt
public void setLastLoginAttempt(java.util.Date dt)Sets the time of the last login attempt. -
getLastLoginAttempt
public java.util.Date getLastLoginAttempt()Returns the time of the last login attempt.- See Also:
setLastLoginAttempt(Date dt)
-
getAuthTokens
Returns the authentication tokens. -
setAuthTokens
-
getAuthIdentities
Returns the authentication identities. -
setAuthIdentities
-
getId
public long getId() -
setId
public void setId(long id) -
getVersion
public int getVersion() -
setVersion
public void setVersion(int version)
-