File tree Expand file tree Collapse file tree 8 files changed +113
-0
lines changed
modules/openapi-generator/src/main/resources/Java/libraries/restclient
echo_api/java/restclient/src/main/java/org/openapitools/client
others/java/restclient-useAbstractionForFiles/src/main/java/org/openapitools/client
restclient-nullable-arrays/src/main/java/org/openapitools/client
restclient-swagger2/src/main/java/org/openapitools/client
restclient-useSingleRequestParameter/src/main/java/org/openapitools/client
restclient/src/main/java/org/openapitools/client Expand file tree Collapse file tree 8 files changed +113
-0
lines changed Original file line number Diff line number Diff line change @@ -631,6 +631,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
631631- [ act coding] ( https://github.com/actcoding )
632632- [ Adaptant Solutions AG] ( https://www.adaptant.io/ )
633633- [ adesso SE] ( https://www.adesso.de/ )
634+ - [ adorsys GmbH & Co.KG] ( https://adorsys.com/ )
634635- [ Adyen] ( https://www.adyen.com/ )
635636- [ Agoda] ( https://www.agoda.com/ )
636637- [ Airthings] ( https://www.airthings.com/ )
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ import java.util.List;
4444import java.util.Map;
4545import java.util.Map.Entry;
4646import java.util.TimeZone;
47+ import java.util.function.Supplier;
4748
4849import { {javaxPackage} }.annotation.Nullable;
4950
@@ -240,6 +241,21 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
240241 throw new RuntimeException("No Bearer authentication configured!");
241242 }
242243
244+ /**
245+ * Helper method to set the supplier of access tokens for Bearer authentication.
246+ *
247+ * @param tokenSupplier the token supplier function
248+ */
249+ public void setBearerToken(Supplier<String > tokenSupplier) {
250+ for (Authentication auth : authentications.values()) {
251+ if (auth instanceof HttpBearerAuth) {
252+ ((HttpBearerAuth) auth).setBearerToken(tokenSupplier);
253+ return;
254+ }
255+ }
256+ throw new RuntimeException("No Bearer authentication configured!");
257+ }
258+
243259 /**
244260 * Helper method to set username for the first HTTP basic authentication.
245261 * @param username the username
Original file line number Diff line number Diff line change 4646import java .util .Map ;
4747import java .util .Map .Entry ;
4848import java .util .TimeZone ;
49+ import java .util .function .Supplier ;
4950
5051import jakarta .annotation .Nullable ;
5152
@@ -222,6 +223,21 @@ public void setBearerToken(String bearerToken) {
222223 throw new RuntimeException ("No Bearer authentication configured!" );
223224 }
224225
226+ /**
227+ * Helper method to set the supplier of access tokens for Bearer authentication.
228+ *
229+ * @param tokenSupplier the token supplier function
230+ */
231+ public void setBearerToken (Supplier <String > tokenSupplier ) {
232+ for (Authentication auth : authentications .values ()) {
233+ if (auth instanceof HttpBearerAuth ) {
234+ ((HttpBearerAuth ) auth ).setBearerToken (tokenSupplier );
235+ return ;
236+ }
237+ }
238+ throw new RuntimeException ("No Bearer authentication configured!" );
239+ }
240+
225241 /**
226242 * Helper method to set username for the first HTTP basic authentication.
227243 * @param username the username
Original file line number Diff line number Diff line change 4646import java .util .Map ;
4747import java .util .Map .Entry ;
4848import java .util .TimeZone ;
49+ import java .util .function .Supplier ;
4950
5051import jakarta .annotation .Nullable ;
5152
@@ -220,6 +221,21 @@ public void setBearerToken(String bearerToken) {
220221 throw new RuntimeException ("No Bearer authentication configured!" );
221222 }
222223
224+ /**
225+ * Helper method to set the supplier of access tokens for Bearer authentication.
226+ *
227+ * @param tokenSupplier the token supplier function
228+ */
229+ public void setBearerToken (Supplier <String > tokenSupplier ) {
230+ for (Authentication auth : authentications .values ()) {
231+ if (auth instanceof HttpBearerAuth ) {
232+ ((HttpBearerAuth ) auth ).setBearerToken (tokenSupplier );
233+ return ;
234+ }
235+ }
236+ throw new RuntimeException ("No Bearer authentication configured!" );
237+ }
238+
223239 /**
224240 * Helper method to set username for the first HTTP basic authentication.
225241 * @param username the username
Original file line number Diff line number Diff line change 4646import java .util .Map ;
4747import java .util .Map .Entry ;
4848import java .util .TimeZone ;
49+ import java .util .function .Supplier ;
4950
5051import jakarta .annotation .Nullable ;
5152
@@ -220,6 +221,21 @@ public void setBearerToken(String bearerToken) {
220221 throw new RuntimeException ("No Bearer authentication configured!" );
221222 }
222223
224+ /**
225+ * Helper method to set the supplier of access tokens for Bearer authentication.
226+ *
227+ * @param tokenSupplier the token supplier function
228+ */
229+ public void setBearerToken (Supplier <String > tokenSupplier ) {
230+ for (Authentication auth : authentications .values ()) {
231+ if (auth instanceof HttpBearerAuth ) {
232+ ((HttpBearerAuth ) auth ).setBearerToken (tokenSupplier );
233+ return ;
234+ }
235+ }
236+ throw new RuntimeException ("No Bearer authentication configured!" );
237+ }
238+
223239 /**
224240 * Helper method to set username for the first HTTP basic authentication.
225241 * @param username the username
Original file line number Diff line number Diff line change 4646import java .util .Map ;
4747import java .util .Map .Entry ;
4848import java .util .TimeZone ;
49+ import java .util .function .Supplier ;
4950
5051import jakarta .annotation .Nullable ;
5152
@@ -226,6 +227,21 @@ public void setBearerToken(String bearerToken) {
226227 throw new RuntimeException ("No Bearer authentication configured!" );
227228 }
228229
230+ /**
231+ * Helper method to set the supplier of access tokens for Bearer authentication.
232+ *
233+ * @param tokenSupplier the token supplier function
234+ */
235+ public void setBearerToken (Supplier <String > tokenSupplier ) {
236+ for (Authentication auth : authentications .values ()) {
237+ if (auth instanceof HttpBearerAuth ) {
238+ ((HttpBearerAuth ) auth ).setBearerToken (tokenSupplier );
239+ return ;
240+ }
241+ }
242+ throw new RuntimeException ("No Bearer authentication configured!" );
243+ }
244+
229245 /**
230246 * Helper method to set username for the first HTTP basic authentication.
231247 * @param username the username
Original file line number Diff line number Diff line change 4646import java .util .Map ;
4747import java .util .Map .Entry ;
4848import java .util .TimeZone ;
49+ import java .util .function .Supplier ;
4950
5051import jakarta .annotation .Nullable ;
5152
@@ -226,6 +227,21 @@ public void setBearerToken(String bearerToken) {
226227 throw new RuntimeException ("No Bearer authentication configured!" );
227228 }
228229
230+ /**
231+ * Helper method to set the supplier of access tokens for Bearer authentication.
232+ *
233+ * @param tokenSupplier the token supplier function
234+ */
235+ public void setBearerToken (Supplier <String > tokenSupplier ) {
236+ for (Authentication auth : authentications .values ()) {
237+ if (auth instanceof HttpBearerAuth ) {
238+ ((HttpBearerAuth ) auth ).setBearerToken (tokenSupplier );
239+ return ;
240+ }
241+ }
242+ throw new RuntimeException ("No Bearer authentication configured!" );
243+ }
244+
229245 /**
230246 * Helper method to set username for the first HTTP basic authentication.
231247 * @param username the username
Original file line number Diff line number Diff line change 4646import java .util .Map ;
4747import java .util .Map .Entry ;
4848import java .util .TimeZone ;
49+ import java .util .function .Supplier ;
4950
5051import jakarta .annotation .Nullable ;
5152
@@ -226,6 +227,21 @@ public void setBearerToken(String bearerToken) {
226227 throw new RuntimeException ("No Bearer authentication configured!" );
227228 }
228229
230+ /**
231+ * Helper method to set the supplier of access tokens for Bearer authentication.
232+ *
233+ * @param tokenSupplier the token supplier function
234+ */
235+ public void setBearerToken (Supplier <String > tokenSupplier ) {
236+ for (Authentication auth : authentications .values ()) {
237+ if (auth instanceof HttpBearerAuth ) {
238+ ((HttpBearerAuth ) auth ).setBearerToken (tokenSupplier );
239+ return ;
240+ }
241+ }
242+ throw new RuntimeException ("No Bearer authentication configured!" );
243+ }
244+
229245 /**
230246 * Helper method to set username for the first HTTP basic authentication.
231247 * @param username the username
You can’t perform that action at this time.
0 commit comments