Package org.graylog2.security
Class AccessTokenServiceImpl
java.lang.Object
org.graylog2.database.PersistedServiceImpl
org.graylog2.security.AccessTokenServiceImpl
- All Implemented Interfaces:
PersistedService
,AccessTokenService
@Singleton
public class AccessTokenServiceImpl
extends PersistedServiceImpl
implements AccessTokenService
Provides access to access tokens in the database.
The token value will automatically be encrypted/decrypted when storing/loading the token object from the database.
That means the token value is encrypted at rest but the loaded
AccessToken
always contains the plain text value.-
Field Summary
Fields inherited from class org.graylog2.database.PersistedServiceImpl
mongoConnection
-
Constructor Summary
ConstructorDescriptionAccessTokenServiceImpl
(MongoConnection mongoConnection, AccessTokenCipher accessTokenCipher) -
Method Summary
Modifier and TypeMethodDescriptionint
deleteAllForUser
(String username) save
(AccessToken accessToken) void
setLastAccessCache
(long duration, TimeUnit unit) org.joda.time.DateTime
touch
(AccessToken accessToken) Methods inherited from class org.graylog2.database.PersistedServiceImpl
collection, collection, count, count, cursorToList, destroy, destroy, destroyAll, destroyAll, destroyAll, embed, fieldTransformations, findOne, findOne, findOne, findOne, get, get, get, query, query, query, query, query, removeEmbedded, removeEmbedded, save, saveWithoutValidation, totalCount, totalCount, validate, validate, validate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.graylog2.plugin.database.PersistedService
destroy, destroyAll, save, saveWithoutValidation, validate, validate, validate
-
Constructor Details
-
AccessTokenServiceImpl
@Inject public AccessTokenServiceImpl(MongoConnection mongoConnection, AccessTokenCipher accessTokenCipher)
-
-
Method Details
-
load
- Specified by:
load
in interfaceAccessTokenService
-
loadById
- Specified by:
loadById
in interfaceAccessTokenService
-
loadAll
- Specified by:
loadAll
in interfaceAccessTokenService
-
create
- Specified by:
create
in interfaceAccessTokenService
-
touch
- Specified by:
touch
in interfaceAccessTokenService
- Throws:
ValidationException
-
save
- Specified by:
save
in interfaceAccessTokenService
- Throws:
ValidationException
-
deleteAllForUser
- Specified by:
deleteAllForUser
in interfaceAccessTokenService
-
setLastAccessCache
- Specified by:
setLastAccessCache
in interfaceAccessTokenService
-