Package io.jmix.superset.client.impl
Class SupersetClientImpl
java.lang.Object
io.jmix.superset.client.impl.SupersetClientImpl
- All Implemented Interfaces:
- SupersetClient
@Service("sprset_SupersetService")
public class SupersetClientImpl
extends Object
implements SupersetClient
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected SupersetCookieManagerprotected HttpClientprotected com.fasterxml.jackson.databind.ObjectMapperprotected final SupersetProperties
- 
Constructor SummaryConstructorsConstructorDescriptionSupersetClientImpl(SupersetProperties properties, SupersetCookieManager cookieManager) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected HttpClientprotected com.fasterxml.jackson.databind.ObjectMapperprotected voidcheckGuestTokenResources(List<GuestTokenBody.Resource> resources) fetchCsrfToken(String accessToken) Performs a request to get a CSRF token/api/v1/security/csrf_token.fetchGuestToken(GuestTokenBody body, String accessToken, String csrfToken) Performs a guest token request/api/v1/security/guest_token.login()Performs POST login request/api/v1/security/loginwith default body configuration.Performs POST login request/api/v1/security/login.Performs refresh access token request/api/v1/security/refresh.
- 
Field Details- 
properties
- 
httpClient
- 
objectMapperprotected com.fasterxml.jackson.databind.ObjectMapper objectMapper
- 
cookieManager
 
- 
- 
Constructor Details- 
SupersetClientImpl
 
- 
- 
Method Details- 
loginDescription copied from interface:SupersetClientPerforms POST login request/api/v1/security/loginwith default body configuration. The request blocks current thread.Note, that failed request will return response with messageproperty.- Specified by:
- loginin interface- SupersetClient
- Returns:
- response with JWT access token and refresh token
- Throws:
- IOException- if an I/ O error occurs when sending or receiving
- InterruptedException- if the operation is interrupted
 
- 
loginDescription copied from interface:SupersetClientPerforms POST login request/api/v1/security/login. The request blocks current thread.Note, that failed request will return response with messageproperty.- Specified by:
- loginin interface- SupersetClient
- Parameters:
- body- request body
- Returns:
- response with JWT access token and refresh token
- Throws:
- IOException- if an I/ O error occurs when sending or receiving
- InterruptedException- if the operation is interrupted
 
- 
refreshDescription copied from interface:SupersetClientPerforms refresh access token request/api/v1/security/refresh. The request blocks current thread.Note, that failed request will return response with systemMessageproperty.- Specified by:
- refreshin interface- SupersetClient
- Parameters:
- refreshToken- refresh token to send
- Returns:
- response with new JWT access token
- Throws:
- IOException- if an I/ O error occurs when sending or receiving
- InterruptedException- if the operation is interrupted
 
- 
fetchGuestTokenpublic GuestTokenResponse fetchGuestToken(GuestTokenBody body, String accessToken, @Nullable String csrfToken) throws IOException, InterruptedException Description copied from interface:SupersetClientPerforms a guest token request/api/v1/security/guest_token. The request blocks current thread. The guest token can be used to embed a dashboard.Note, that failed request will return response with messageorsystemMessageproperty.- Specified by:
- fetchGuestTokenin interface- SupersetClient
- Parameters:
- body- the body to send
- accessToken- access token that can be taken from- SupersetClient.login(LoginBody)
- csrfToken- CSRF token should be passed if- SupersetProperties.isCsrfProtectionEnabled()is enabled
- Returns:
- response with guest token
- Throws:
- IOException- if an I/ O error occurs when sending or receiving
- InterruptedException- if the operation is interrupted
 
- 
fetchCsrfTokenpublic CsrfTokenResponse fetchCsrfToken(String accessToken) throws IOException, InterruptedException Description copied from interface:SupersetClientPerforms a request to get a CSRF token/api/v1/security/csrf_token. The request blocks current thread. CSRF token is required when Superset configures CSRF protection.When SupersetProperties.isCsrfProtectionEnabled()is enabled a Spring scheduler gets CSRF token on Spring refresh context. SeeSupersetTokenScheduleConfigurerandSupersetTokenManager.- Specified by:
- fetchCsrfTokenin interface- SupersetClient
- Parameters:
- accessToken- access token to send
- Returns:
- response with CSRF token
- Throws:
- IOException- if an I/ O error occurs when sending or receiving
- InterruptedException- if the operation is interrupted
 
- 
buildHttpClient
- 
buildObjectMapperprotected com.fasterxml.jackson.databind.ObjectMapper buildObjectMapper()
- 
checkGuestTokenResources
 
-