org.bonitasoft.web.client.api.PortalAuthenticationApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bonita-java-client Show documentation
Show all versions of bonita-java-client Show documentation
Java client for Bonita REST API
The newest version!
/**
* Copyright (C) 2023 BonitaSoft S.A.
* BonitaSoft, 32 rue Gustave Eiffel - 38000 Grenoble
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package org.bonitasoft.web.client.api;
import java.util.HashMap;
import java.util.Map;
import org.bonitasoft.web.client.invoker.ApiClient;
import org.bonitasoft.web.client.invoker.EncodingUtils;
import feign.Headers;
import feign.Param;
import feign.QueryMap;
import feign.RequestLine;
import feign.Response;
public interface PortalAuthenticationApi extends ApiClient.Api {
/**
* Login A call to the `/loginservice` will generates a set-cookie header in the
* response. The `JSESSIONID` cookie must be transfered with each subsequent calls. (If
* the REST API is used in an application running in a web browser, this is handled automatically
* by the web browser just like any cookies). Additional protection agains CSRF attacks is enabled
* by default for all fresh installations This security relies on `X-Bonita-API-Token`
* information. The `X-Bonita-API-Token` value can be found in the cookie named:
* `X-Bonita-API-Token`. All the subsequence REST API calls performing changes in the
* system using DELETE, POST, or PUT HTTP methods must contain the **HTTP header** below:
* ``` X-Bonita-API-Token: example-dummy-not-be-used-value ```
*
* @param username the username (required)
* @param password the password (required)
* @param tenant the user tenant (optional)
* @param redirect \\\"true\\\" or \\\"false\\\". \\\"false\\\"
* indicates that the service should not redirect to Bonita Portal (after a successful login)
* or to the login page (after a login failure). (optional, default to "false")
* @param redirectURL the URL of the page to be displayed after login (optional, default to
* "")
* @return String
*/
@RequestLine("POST /loginservice")
@Headers({
"Content-Type: application/x-www-form-urlencoded",
"Accept: application/json",
})
Response login(
@Param("username") String username,
@Param("password") String password,
@Param("tenant") String tenant,
@Param("redirect") String redirect,
@Param("redirectURL") String redirectURL);
/**
* Logout the current user Logout the current user from the system
*
* @param redirect Setting the redirect parameter to false indicates that the service should not
* redirect to the login page after logging out. (optional)
*/
@RequestLine("GET /logoutservice?redirect={redirect}")
@Headers({
"Accept: application/json",
})
void logout(@Param("redirect") String redirect);
/**
* Logout the current user Logout the current user from the system Note, this is equivalent to the
* other logout
method, but with the query parameters collected into a single Map
* parameter. This is convenient for services with optional query parameters, especially when used
* with the {@link LogoutQueryParams} class that allows for building up this map in a fluent
* style.
*
* @param queryParams Map of query parameters as name-value pairs
* The following elements may be specified in the query map:
*
* - redirect - Setting the redirect parameter to false indicates that the service should
* not redirect to the login page after logging out. (optional)
*
*/
@RequestLine("GET /logoutservice?redirect={redirect}")
@Headers({
"Accept: application/json",
})
void logout(@QueryMap(encoded = true) Map queryParams);
/**
* A convenience class for generating query parameters for the logout
method in a
* fluent style.
*/
class LogoutQueryParams extends HashMap {
public LogoutQueryParams redirect(final String value) {
put("redirect", EncodingUtils.encode(value));
return this;
}
}
}