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
Constructors -
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.intReturns the number of failed login attempts.longgetId()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.intvoidsetAuthIdentities(List<AuthIdentity> authIdentities) voidsetAuthTokens(List<AuthToken> authTokens) voidSets the email address.voidsetEmailToken(String emailToken) voidsetEmailToken(String hash, Date expires, EmailTokenRole role) Sets the email token.voidsetEmailTokenExpires(Date emailTokenExpires) voidsetEmailTokenRole(EmailTokenRole emailTokenRole) voidsetFailedLoginAttempts(int count) Sets the number of failed login attempts.voidsetId(long id) voidSets the time of the last login attempt.voidsetPassword(String hash, String hashFunction, String hashSalt) Sets a password.voidsetPasswordHash(String passwordHash) voidsetPasswordMethod(String passwordMethod) voidsetPasswordSalt(String passwordSalt) voidsetStatus(AccountStatus status) Sets the status.voidsetUnverifiedEmail(String email) Sets the unverified email address.voidsetUser(AbstractUser user) Sets the user.voidsetVersion(int version)
-
Constructor Details
-
AuthInfo
public AuthInfo()
-
-
Method Details
-
setUser
Sets the user. This sets the user that owns this authentication information.AbstractUseris 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.- See Also:
-
setPasswordHash
-
getPasswordMethod
Returns the password method.- See Also:
-
setPasswordMethod
-
getPasswordSalt
Returns the password salt.- See Also:
-
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.- See Also:
-
setEmailToken
-
getEmailTokenExpires
Returns the email token expiration date.- See Also:
-
setEmailTokenExpires
-
getEmailTokenRole
Returns the email token role.- See Also:
-
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)
-