Class AuthTokenService
- java.lang.Object
-
- com.floragunn.searchguard.authtoken.AuthTokenService
-
- All Implemented Interfaces:
com.floragunn.searchguard.privileges.SpecialPrivilegesEvaluationContextProvider
public class AuthTokenService extends Object implements com.floragunn.searchguard.privileges.SpecialPrivilegesEvaluationContextProvider
-
-
Field Summary
Fields Modifier and Type Field Description static org.elasticsearch.common.settings.Setting<org.elasticsearch.common.unit.TimeValue>CLEANUP_INTERVALstatic org.elasticsearch.common.settings.Setting<String>INDEX_NAMEstatic StringUSER_TYPEstatic StringUSER_TYPE_FULL_CURRENT_PERMISSIONS
-
Constructor Summary
Constructors Constructor Description AuthTokenService(com.floragunn.searchguard.support.PrivilegedConfigClient privilegedConfigClient, ConfigHistoryService configHistoryService, org.elasticsearch.common.settings.Settings settings, org.elasticsearch.threadpool.ThreadPool threadPool, org.elasticsearch.cluster.service.ClusterService clusterService, com.floragunn.searchguard.configuration.ProtectedConfigIndexService protectedConfigIndexService, AuthTokenServiceConfig config)AuthTokenService(com.floragunn.searchguard.support.PrivilegedConfigClient privilegedConfigClient, ConfigHistoryService configHistoryService, org.elasticsearch.common.settings.Settings settings, org.elasticsearch.threadpool.ThreadPool threadPool, org.elasticsearch.cluster.service.ClusterService clusterService, com.floragunn.searchguard.configuration.ProtectedConfigIndexService protectedConfigIndexService, AuthTokenServiceConfig config, com.floragunn.searchguard.modules.state.ComponentState componentState)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthTokencreate(com.floragunn.searchguard.user.User user, CreateAuthTokenRequest request)CreateAuthTokenResponsecreateJwt(com.floragunn.searchguard.user.User user, CreateAuthTokenRequest request)AuthTokengetByClaims(Map<String,Object> claims)voidgetByClaims(Map<String,Object> claims, Consumer<AuthToken> onResult, Consumer<NoSuchAuthTokenException> onNoSuchAuthToken, Consumer<Exception> onFailure)AuthTokengetById(String id)voidgetById(String id, Consumer<AuthToken> onResult, Consumer<NoSuchAuthTokenException> onNoSuchAuthToken, Consumer<Exception> onFailure)AuthTokengetByIdFromIndex(String id)voidgetByIdFromIndex(String id, Consumer<AuthToken> onResult, Consumer<NoSuchAuthTokenException> onNoSuchAuthToken, Consumer<Exception> onFailure)AuthTokengetByIdWithConfigSnapshot(String id)voidgetByIdWithConfigSnapshot(String id, Consumer<AuthToken> onResult, Consumer<NoSuchAuthTokenException> onNoSuchAuthToken, Consumer<Exception> onFailure)com.floragunn.searchguard.modules.state.ComponentStategetComponentState()AuthTokenServiceConfiggetConfig()org.apache.cxf.rs.security.jose.jwk.JsonWebKeygetEncryptionKey()StringgetIndexName()org.apache.cxf.rs.security.jose.jwk.JsonWebKeygetSigningKey()org.apache.cxf.rs.security.jose.jwt.JwtTokengetVerifiedJwtToken(String encodedJwt)booleanisInitialized()voidprovide(com.floragunn.searchguard.user.User user, org.elasticsearch.common.util.concurrent.ThreadContext threadContext, Consumer<com.floragunn.searchguard.privileges.SpecialPrivilegesEvaluationContext> onResult, Consumer<Exception> onFailure)StringpushAuthTokenUpdate(PushAuthTokenUpdateRequest request)Stringrevoke(com.floragunn.searchguard.user.User user, String id)voidsetConfig(AuthTokenServiceConfig config)voidsetEncryptionKey(org.apache.cxf.rs.security.jose.jwk.JsonWebKey encryptionKey)voidsetKeys(org.apache.cxf.rs.security.jose.jwk.JsonWebKey signingKey, org.apache.cxf.rs.security.jose.jwk.JsonWebKey encryptionKey)voidsetSigningKey(org.apache.cxf.rs.security.jose.jwk.JsonWebKey signingKey)voidshutdown()voidwaitForInitComplete(long timeoutMillis)
-
-
-
Field Detail
-
INDEX_NAME
public static final org.elasticsearch.common.settings.Setting<String> INDEX_NAME
-
CLEANUP_INTERVAL
public static final org.elasticsearch.common.settings.Setting<org.elasticsearch.common.unit.TimeValue> CLEANUP_INTERVAL
-
USER_TYPE
public static final String USER_TYPE
- See Also:
- Constant Field Values
-
USER_TYPE_FULL_CURRENT_PERMISSIONS
public static final String USER_TYPE_FULL_CURRENT_PERMISSIONS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AuthTokenService
public AuthTokenService(com.floragunn.searchguard.support.PrivilegedConfigClient privilegedConfigClient, ConfigHistoryService configHistoryService, org.elasticsearch.common.settings.Settings settings, org.elasticsearch.threadpool.ThreadPool threadPool, org.elasticsearch.cluster.service.ClusterService clusterService, com.floragunn.searchguard.configuration.ProtectedConfigIndexService protectedConfigIndexService, AuthTokenServiceConfig config, com.floragunn.searchguard.modules.state.ComponentState componentState)
-
AuthTokenService
public AuthTokenService(com.floragunn.searchguard.support.PrivilegedConfigClient privilegedConfigClient, ConfigHistoryService configHistoryService, org.elasticsearch.common.settings.Settings settings, org.elasticsearch.threadpool.ThreadPool threadPool, org.elasticsearch.cluster.service.ClusterService clusterService, com.floragunn.searchguard.configuration.ProtectedConfigIndexService protectedConfigIndexService, AuthTokenServiceConfig config)
-
-
Method Detail
-
getById
public AuthToken getById(String id) throws NoSuchAuthTokenException
- Throws:
NoSuchAuthTokenException
-
getById
public void getById(String id, Consumer<AuthToken> onResult, Consumer<NoSuchAuthTokenException> onNoSuchAuthToken, Consumer<Exception> onFailure)
-
getByIdFromIndex
public AuthToken getByIdFromIndex(String id) throws NoSuchAuthTokenException
- Throws:
NoSuchAuthTokenException
-
getByIdFromIndex
public void getByIdFromIndex(String id, Consumer<AuthToken> onResult, Consumer<NoSuchAuthTokenException> onNoSuchAuthToken, Consumer<Exception> onFailure)
-
getByClaims
public AuthToken getByClaims(Map<String,Object> claims) throws NoSuchAuthTokenException, InvalidTokenException
-
getByClaims
public void getByClaims(Map<String,Object> claims, Consumer<AuthToken> onResult, Consumer<NoSuchAuthTokenException> onNoSuchAuthToken, Consumer<Exception> onFailure) throws InvalidTokenException
- Throws:
InvalidTokenException
-
getByIdWithConfigSnapshot
public void getByIdWithConfigSnapshot(String id, Consumer<AuthToken> onResult, Consumer<NoSuchAuthTokenException> onNoSuchAuthToken, Consumer<Exception> onFailure)
-
getByIdWithConfigSnapshot
public AuthToken getByIdWithConfigSnapshot(String id) throws NoSuchAuthTokenException
- Throws:
NoSuchAuthTokenException
-
create
public AuthToken create(com.floragunn.searchguard.user.User user, CreateAuthTokenRequest request) throws TokenCreationException
- Throws:
TokenCreationException
-
createJwt
public CreateAuthTokenResponse createJwt(com.floragunn.searchguard.user.User user, CreateAuthTokenRequest request) throws TokenCreationException
- Throws:
TokenCreationException
-
getVerifiedJwtToken
public org.apache.cxf.rs.security.jose.jwt.JwtToken getVerifiedJwtToken(String encodedJwt) throws org.apache.cxf.rs.security.jose.jwt.JwtException
- Throws:
org.apache.cxf.rs.security.jose.jwt.JwtException
-
revoke
public String revoke(com.floragunn.searchguard.user.User user, String id) throws NoSuchAuthTokenException, TokenUpdateException
-
setConfig
public void setConfig(AuthTokenServiceConfig config)
-
waitForInitComplete
public void waitForInitComplete(long timeoutMillis)
-
pushAuthTokenUpdate
public String pushAuthTokenUpdate(PushAuthTokenUpdateRequest request)
-
getSigningKey
public org.apache.cxf.rs.security.jose.jwk.JsonWebKey getSigningKey()
-
setSigningKey
public void setSigningKey(org.apache.cxf.rs.security.jose.jwk.JsonWebKey signingKey)
-
getEncryptionKey
public org.apache.cxf.rs.security.jose.jwk.JsonWebKey getEncryptionKey()
-
setEncryptionKey
public void setEncryptionKey(org.apache.cxf.rs.security.jose.jwk.JsonWebKey encryptionKey)
-
setKeys
public void setKeys(org.apache.cxf.rs.security.jose.jwk.JsonWebKey signingKey, org.apache.cxf.rs.security.jose.jwk.JsonWebKey encryptionKey)
-
provide
public void provide(com.floragunn.searchguard.user.User user, org.elasticsearch.common.util.concurrent.ThreadContext threadContext, Consumer<com.floragunn.searchguard.privileges.SpecialPrivilegesEvaluationContext> onResult, Consumer<Exception> onFailure)- Specified by:
providein interfacecom.floragunn.searchguard.privileges.SpecialPrivilegesEvaluationContextProvider
-
shutdown
public void shutdown()
-
getIndexName
public String getIndexName()
-
getConfig
public AuthTokenServiceConfig getConfig()
-
isInitialized
public boolean isInitialized()
-
getComponentState
public com.floragunn.searchguard.modules.state.ComponentState getComponentState()
-
-