Package eu.webtoolkit.jwt.auth.jpa
Class AuthInfo
java.lang.Object
eu.webtoolkit.jwt.auth.jpa.AuthInfo
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:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the authentication identities.Returns the authentication tokens.getEmail()
Returns the email address.Returns the email token.Returns the email token expiration date.Returns the email token role.int
Returns the number of failed login attempts.long
getId()
Returns the time of the last login attempt.Returns the password hash.Returns the password method.Returns the password salt.Returns the status.Returns the unverified email address.getUser()
Returns a reference to the user.int
void
setAuthIdentities
(List<AuthIdentity> authIdentities) void
setAuthTokens
(List<AuthToken> authTokens) void
Sets the email address.void
setEmailToken
(String emailToken) void
setEmailToken
(String hash, Date expires, EmailTokenRole role) Sets the email token.void
setEmailTokenExpires
(Date emailTokenExpires) void
setEmailTokenRole
(EmailTokenRole emailTokenRole) void
setFailedLoginAttempts
(int count) Sets the number of failed login attempts.void
setId
(long id) void
Sets the time of the last login attempt.void
setPassword
(String hash, String hashFunction, String hashSalt) Sets a password.void
setPasswordHash
(String passwordHash) void
setPasswordMethod
(String passwordMethod) void
setPasswordSalt
(String passwordSalt) void
setStatus
(AccountStatus status) Sets the status.void
setUnverifiedEmail
(String email) Sets the unverified email address.void
setUser
(AbstractUser user) Sets the user.void
setVersion
(int version)
-
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:
-
setPassword
Sets a password. -
getPasswordHash
Returns the password hash. -
setPasswordHash
-
getPasswordMethod
Returns the password method. -
setPasswordMethod
-
getPasswordSalt
Returns the password salt. -
setPasswordSalt
-
setEmail
Sets the email address. -
getEmail
Returns the email address.- See Also:
-
setUnverifiedEmail
Sets the unverified email address. -
getUnverifiedEmail
Returns the unverified email address.- See Also:
-
setEmailToken
Sets the email token. -
getEmailToken
Returns the email token. -
setEmailToken
-
getEmailTokenExpires
Returns the email token expiration date. -
setEmailTokenExpires
-
getEmailTokenRole
Returns the email token role. -
setEmailTokenRole
-
setStatus
Sets the status. -
getStatus
Returns the status.- See Also:
-
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:
-
setLastLoginAttempt
Sets the time of the last login attempt. -
getLastLoginAttempt
Returns the time of the last login attempt.- See Also:
-
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)
-