Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,15 @@ src/main/java/org/bonitasoft/web/client/invoker/EncodingUtils.java
src/main/java/org/bonitasoft/web/client/invoker/ParamExpander.java
src/main/java/org/bonitasoft/web/client/invoker/RFC3339DateFormat.java
src/main/java/org/bonitasoft/web/client/invoker/StringUtil.java
src/main/java/org/bonitasoft/web/client/invoker/auth/ApiErrorDecoder.java
src/main/java/org/bonitasoft/web/client/invoker/auth/ApiKeyAuth.java
src/main/java/org/bonitasoft/web/client/invoker/auth/DefaultApi20Impl.java
src/main/java/org/bonitasoft/web/client/invoker/auth/HttpBasicAuth.java
src/main/java/org/bonitasoft/web/client/invoker/auth/HttpBearerAuth.java
src/main/java/org/bonitasoft/web/client/invoker/auth/OAuth.java
src/main/java/org/bonitasoft/web/client/invoker/auth/OAuthFlow.java
src/main/java/org/bonitasoft/web/client/invoker/auth/OauthClientCredentialsGrant.java
src/main/java/org/bonitasoft/web/client/invoker/auth/OauthPasswordGrant.java
src/main/java/org/bonitasoft/web/client/model/AbstractArchivedTask.java
src/main/java/org/bonitasoft/web/client/model/AbstractTask.java
src/main/java/org/bonitasoft/web/client/model/ActivationState.java
Expand Down
1 change: 1 addition & 0 deletions .openapi-generator/oidc-spec.yaml-default.sha256
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
841436302f809be6453684ff0450e07a5c3e92518c8f2454a058f2b849a97247
13 changes: 13 additions & 0 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ servers:
security:
- bonita_auth: []
bonita_token: []
- openId:
- admin
- user
tags:
- description: Activity
name: Activity
Expand Down Expand Up @@ -22098,6 +22101,16 @@ components:
- value
type: object
securitySchemes:
oauth_access_code:
flows:
authorizationCode:
scopes: {}
type: oauth2
oauth_password:
flows:
password:
scopes: {}
type: oauth2
bonita_auth:
description: |
To call the REST API, you must first log on with a user registered in the Engine database. Please refer to the __[Login API](#operation/login)__ operations section.
Expand Down
21,055 changes: 21,055 additions & 0 deletions oidc-spec.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@
<generateModelDocumentation>false</generateModelDocumentation>
<output>${project.basedir}</output>
<skipIfSpecIsUnchanged>true</skipIfSpecIsUnchanged>
<inputSpec>${project.basedir}/api/openapi.yaml</inputSpec>
<inputSpec>${project.basedir}/oidc-spec.yaml</inputSpec>
<generatorName>java</generatorName>
<invokerPackage>org.bonitasoft.web.client.invoker</invokerPackage>
<apiPackage>org.bonitasoft.web.client.api</apiPackage>
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/org/bonitasoft/web/client/AccessCodeAuthBuilder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright (C) 2025 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 <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.web.client;

public interface AccessCodeAuthBuilder extends AuthBuilder {

AccessCodeAuthBuilder setPouet(String pouet);
}
35 changes: 35 additions & 0 deletions src/main/java/org/bonitasoft/web/client/AuthBuilder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright (C) 2025 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 <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.web.client;

import org.bonitasoft.web.client.feign.auth.AccessCodeFeignAuthBuilder;
import org.bonitasoft.web.client.feign.auth.BonitaCookieFeignAuthBuilder;

import feign.RequestInterceptor;

public interface AuthBuilder {

static BonitaCookieAuthBuilder cookieAuth() {
return new BonitaCookieFeignAuthBuilder();
}

static AccessCodeAuthBuilder accessCodeAuth() {
return new AccessCodeFeignAuthBuilder();
}

RequestInterceptor build();
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,12 @@ public interface BonitaClientBuilder<T extends BonitaClientBuilder<T>> {
* @return the current builder
*/
T disableRetry(boolean disableRetry);

/**
* Configure the client authentication method
*
* @param authBuilder
* @return
*/
T auth(AuthBuilder authBuilder);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Copyright (C) 2025 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 <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.web.client;

public interface BonitaCookieAuthBuilder extends AuthBuilder {

BonitaCookieAuthBuilder setPlouf(String plouf);

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;

import org.bonitasoft.web.client.AuthBuilder;
import org.bonitasoft.web.client.BonitaClient;
import org.bonitasoft.web.client.exception.ClientException;
import org.bonitasoft.web.client.feign.decoder.BonitaErrorDecoder;
Expand All @@ -38,17 +39,8 @@
import org.bonitasoft.web.client.invoker.auth.BonitaCookieAuth;
import org.bonitasoft.web.client.invoker.auth.BonitaLoginService;
import org.bonitasoft.web.client.log.LogContentLevel;
import org.bonitasoft.web.client.services.ApplicationService;
import org.bonitasoft.web.client.services.BdmService;
import org.bonitasoft.web.client.services.LoginService;
import org.bonitasoft.web.client.services.ProcessService;
import org.bonitasoft.web.client.services.SystemService;
import org.bonitasoft.web.client.services.UserService;
import org.bonitasoft.web.client.services.impl.DefaultApplicationService;
import org.bonitasoft.web.client.services.impl.DefaultBdmService;
import org.bonitasoft.web.client.services.impl.DefaultProcessService;
import org.bonitasoft.web.client.services.impl.DefaultSystemService;
import org.bonitasoft.web.client.services.impl.DefaultUserService;
import org.bonitasoft.web.client.services.*;
import org.bonitasoft.web.client.services.impl.*;
import org.bonitasoft.web.client.services.impl.base.CachingClientContext;
import org.bonitasoft.web.client.services.impl.base.ClientContext;
import org.bonitasoft.web.client.services.impl.bdm.BdmResponseConverter;
Expand All @@ -60,6 +52,7 @@

import feign.Feign;
import feign.Request;
import feign.RequestInterceptor;
import feign.Retryer;
import lombok.AccessLevel;
import lombok.NonNull;
Expand All @@ -79,7 +72,9 @@ public class BonitaFeignClientBuilderImpl implements BonitaFeignClientBuilder {
@Setter(AccessLevel.NONE)
private final String url;

/** Note about timeouts: default values are the same as in OkHttpClient (10 seconds). */
/**
* Note about timeouts: default values are the same as in OkHttpClient (10 seconds).
*/
@Setter
private int connectTimeoutInSeconds = 10;

Expand Down Expand Up @@ -107,6 +102,9 @@ public class BonitaFeignClientBuilderImpl implements BonitaFeignClientBuilder {
@Setter
private LogContentLevel logContentLevel = LogContentLevel.OFF;

@Setter
private AuthBuilder authBuilder;

@Override
public BonitaClient build() {

Expand All @@ -130,9 +128,16 @@ public BonitaClient build() {
ApiProvider apiProvider = new CachingApiProvider(apiClient);

// Bonita Auth
BonitaCookieAuth authorization = new BonitaCookieAuth();
apiClient.addAuthorization("bonita", authorization);
LoginService loginService = new BonitaLoginService(apiProvider, this.objectMapper, authorization);
if (authBuilder != null) {
RequestInterceptor auth = authBuilder.build();
if (auth != null) {
apiClient.addAuthorization("bonita", auth);
}
}
LoginService loginService = new BonitaLoginService(
apiProvider,
this.objectMapper,
new BonitaCookieAuth(apiProvider));

// Delegate services
final ClientContext clientContext = new CachingClientContext();
Expand All @@ -157,6 +162,12 @@ public BonitaClient build() {
systemService);
}

@Override
public BonitaFeignClientBuilder auth(AuthBuilder authBuilder) {
this.authBuilder = authBuilder;
return this;
}

Feign.Builder configureFeign(Feign.Builder feignBuilder) {
log.debug("Configuring Feign builder ...");
return feignBuilder
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Copyright (C) 2025 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 <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.web.client.feign.auth;

import org.bonitasoft.web.client.AccessCodeAuthBuilder;

import feign.RequestInterceptor;

public class AccessCodeFeignAuthBuilder implements AccessCodeAuthBuilder {

@Override
public AccessCodeAuthBuilder setPouet(String pouet) {
return null;
}

@Override
public RequestInterceptor build() {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Copyright (C) 2025 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 <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.web.client.feign.auth;

import org.bonitasoft.web.client.BonitaCookieAuthBuilder;

import feign.RequestInterceptor;

public class BonitaCookieFeignAuthBuilder implements BonitaCookieAuthBuilder {

@Override
public BonitaCookieAuthBuilder setPlouf(String plouf) {
return null;
}

@Override
public RequestInterceptor build() {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Copyright (C) 2025 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 <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.web.client.feign.auth;

public interface Credentials {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright (C) 2025 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 <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.web.client.feign.auth;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.RequiredArgsConstructor;

@Data
@RequiredArgsConstructor
@AllArgsConstructor
public class UsernamePasswordCredentials implements Credentials {

private final String username;

private final String password;

private String tenant;
}
Loading
Loading