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
FieldsModifier and TypeFieldDescriptionprotected SupersetCookieManagerprotected HttpClientprotected com.fasterxml.jackson.databind.ObjectMapperprotected final SupersetProperties -
Constructor Summary
ConstructorsConstructorDescriptionSupersetClientImpl(SupersetProperties properties, SupersetCookieManager cookieManager) -
Method Summary
Modifier 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
-
objectMapper
protected com.fasterxml.jackson.databind.ObjectMapper objectMapper -
cookieManager
-
-
Constructor Details
-
SupersetClientImpl
-
-
Method Details
-
login
Description 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 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: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 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: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 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: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 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: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 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
-