Package io.jmix.superset.client
Interface SupersetClient
- All Known Implementing Classes:
SupersetClientImpl
public interface SupersetClient
Service for communicating with Superset API.
-
Method Summary
Modifier and TypeMethodDescriptionfetchCsrfToken(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.
-
Method Details
-
login
Performs POST login request/api/v1/security/loginwith default body configuration. The request blocks current thread.Note, that failed request will return response with
messageproperty.- 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 interruptedIllegalStateException- if it cannot write or read JSON value
-
login
Performs POST login request/api/v1/security/login. The request blocks current thread.Note, that failed request will return response with
messageproperty.- 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 interruptedIllegalStateException- if it cannot write or read JSON value
-
refresh
Performs refresh access token request/api/v1/security/refresh. The request blocks current thread.Note, that failed request will return response with
systemMessageproperty.- 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 interruptedIllegalStateException- if it cannot write or read JSON value
-
fetchGuestToken
GuestTokenResponse fetchGuestToken(GuestTokenBody body, String accessToken, @Nullable String csrfToken) throws IOException, InterruptedException 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
messageorsystemMessageproperty.- Parameters:
body- the body to sendaccessToken- access token that can be taken fromlogin(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 interruptedIllegalStateException- if it cannot write or read JSON value
-
fetchCsrfToken
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. SeeSupersetTokenScheduleConfigurerandSupersetTokenManager.- 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 interruptedIllegalStateException- if it cannot read JSON value
-