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 Summary
Modifier and TypeFieldDescriptionprotected SupersetCookieManager
protected HttpClient
protected com.fasterxml.jackson.databind.ObjectMapper
protected final SupersetProperties
-
Constructor Summary
ConstructorDescriptionSupersetClientImpl
(SupersetProperties properties, SupersetCookieManager cookieManager) -
Method Summary
Modifier and TypeMethodDescriptionprotected HttpClient
protected com.fasterxml.jackson.databind.ObjectMapper
protected void
checkGuestTokenResources
(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/login
with default body configuration.Performs POST login request/api/v1/security/login
.Performs refresh access token request/api/v1/security/refresh
.
-
Field Details
-
properties
-
httpClient
-
objectMapper
protected com.fasterxml.jackson.databind.ObjectMapper objectMapper -
cookieManager
-
-
Constructor Details
-
SupersetClientImpl
-
-
Method Details
-
login
Description copied from interface:SupersetClient
Performs POST login request/api/v1/security/login
with default body configuration. The request blocks current thread.Note, that failed request will return response with
message
property.- Specified by:
login
in interfaceSupersetClient
- Returns:
- response with JWT access token and refresh token
- Throws:
IOException
- if an I/ O error occurs when sending or receivingInterruptedException
- if the operation is interrupted
-
login
Description copied from interface:SupersetClient
Performs POST login request/api/v1/security/login
. The request blocks current thread.Note, that failed request will return response with
message
property.- Specified by:
login
in interfaceSupersetClient
- Parameters:
body
- request body- Returns:
- response with JWT access token and refresh token
- Throws:
IOException
- if an I/ O error occurs when sending or receivingInterruptedException
- if the operation is interrupted
-
refresh
Description copied from interface:SupersetClient
Performs refresh access token request/api/v1/security/refresh
. The request blocks current thread.Note, that failed request will return response with
systemMessage
property.- Specified by:
refresh
in interfaceSupersetClient
- Parameters:
refreshToken
- refresh token to send- Returns:
- response with new JWT access token
- Throws:
IOException
- if an I/ O error occurs when sending or receivingInterruptedException
- if the operation is interrupted
-
fetchGuestToken
public GuestTokenResponse fetchGuestToken(GuestTokenBody body, String accessToken, @Nullable String csrfToken) throws IOException, InterruptedException Description copied from interface:SupersetClient
Performs 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
message
orsystemMessage
property.- Specified by:
fetchGuestToken
in interfaceSupersetClient
- Parameters:
body
- the body to sendaccessToken
- access token that can be taken fromSupersetClient.login(LoginBody)
csrfToken
- CSRF token should be passed ifSupersetProperties.isCsrfProtectionEnabled()
is enabled- Returns:
- response with guest token
- Throws:
IOException
- if an I/ O error occurs when sending or receivingInterruptedException
- if the operation is interrupted
-
fetchCsrfToken
public CsrfTokenResponse fetchCsrfToken(String accessToken) throws IOException, InterruptedException Description copied from interface:SupersetClient
Performs 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. SeeSupersetTokenScheduleConfigurer
andSupersetTokenManager
.- Specified by:
fetchCsrfToken
in interfaceSupersetClient
- Parameters:
accessToken
- access token to send- Returns:
- response with CSRF token
- Throws:
IOException
- if an I/ O error occurs when sending or receivingInterruptedException
- if the operation is interrupted
-
buildHttpClient
-
buildObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper buildObjectMapper() -
checkGuestTokenResources
-