Skip to content

Commit

Permalink
Java, simplifies security (#408)
Browse files Browse the repository at this point in the history
* Updates template sto use centralized securitySchemeInfo in apiConfiguration

* Adds and uses getSecurityScheme

* Updates securityinfo docs to show the securty map

* Adds missing class's container class in docs

* Adds docs for security requirement objects

* Adds link from security requirement object doc to security scheme doc

* Fixes links from security info classes to securityequirementObjects

* Removes getSecurityBuilders

* Samples regen
  • Loading branch information
spacether committed Mar 27, 2024
1 parent 37f8b0f commit 06b89d2
Show file tree
Hide file tree
Showing 106 changed files with 1,314 additions and 1,671 deletions.
24 changes: 24 additions & 0 deletions samples/client/petstore/java/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ docs/paths/fake/delete/parameters/parameter3/Schema3.md
docs/paths/fake/delete/parameters/parameter4/Schema4.md
docs/paths/fake/delete/parameters/parameter5/Schema5.md
docs/paths/fake/delete/responses/Code200Response.md
docs/paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md
docs/paths/fake/get/HeaderParameters.md
docs/paths/fake/get/QueryParameters.md
docs/paths/fake/get/RequestBody.md
Expand All @@ -252,6 +253,7 @@ docs/paths/fake/post/Responses.md
docs/paths/fake/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md
docs/paths/fake/post/responses/Code200Response.md
docs/paths/fake/post/responses/Code404Response.md
docs/paths/fake/post/security/FakePostSecurityRequirementObject0.md
docs/paths/fakeadditionalpropertieswitharrayofenums/Get.md
docs/paths/fakeadditionalpropertieswitharrayofenums/get/RequestBody.md
docs/paths/fakeadditionalpropertieswitharrayofenums/get/Responses.md
Expand Down Expand Up @@ -283,6 +285,7 @@ docs/paths/fakeclassnametest/patch/RequestBody.md
docs/paths/fakeclassnametest/patch/Responses.md
docs/paths/fakeclassnametest/patch/responses/Code200Response.md
docs/paths/fakeclassnametest/patch/responses/code200response/content/applicationjson/ApplicationjsonSchema.md
docs/paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md
docs/paths/fakedeletecoffeeid/Delete.md
docs/paths/fakedeletecoffeeid/delete/PathParameters.md
docs/paths/fakedeletecoffeeid/delete/Responses.md
Expand Down Expand Up @@ -343,6 +346,9 @@ docs/paths/fakemultiplesecurities/get/FakemultiplesecuritiesGetSecurityInfo.md
docs/paths/fakemultiplesecurities/get/Responses.md
docs/paths/fakemultiplesecurities/get/responses/Code200Response.md
docs/paths/fakemultiplesecurities/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md
docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.md
docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md
docs/paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md
docs/paths/fakeobjinquery/Get.md
docs/paths/fakeobjinquery/get/QueryParameters.md
docs/paths/fakeobjinquery/get/Responses.md
Expand Down Expand Up @@ -392,6 +398,7 @@ docs/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schem
docs/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/MultipartformdataSchema.md
docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/Code200Response.md
docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/code200response/content/applicationjson/ApplicationjsonSchema.md
docs/paths/fakepetiduploadimagewithrequiredfile/post/security/FakepetiduploadimagewithrequiredfilePostSecurityRequirementObject0.md
docs/paths/fakequeryparamwithjsoncontenttype/Get.md
docs/paths/fakequeryparamwithjsoncontenttype/get/QueryParameters.md
docs/paths/fakequeryparamwithjsoncontenttype/get/Responses.md
Expand Down Expand Up @@ -518,12 +525,17 @@ docs/paths/pet/post/RequestBody.md
docs/paths/pet/post/Responses.md
docs/paths/pet/post/responses/Code200Response.md
docs/paths/pet/post/responses/Code405Response.md
docs/paths/pet/post/security/PetPostSecurityRequirementObject0.md
docs/paths/pet/post/security/PetPostSecurityRequirementObject1.md
docs/paths/pet/post/security/PetPostSecurityRequirementObject2.md
docs/paths/pet/put/PetPutSecurityInfo.md
docs/paths/pet/put/RequestBody.md
docs/paths/pet/put/Responses.md
docs/paths/pet/put/responses/Code400Response.md
docs/paths/pet/put/responses/Code404Response.md
docs/paths/pet/put/responses/Code405Response.md
docs/paths/pet/put/security/PetPutSecurityRequirementObject0.md
docs/paths/pet/put/security/PetPutSecurityRequirementObject1.md
docs/paths/petfindbystatus/Get.md
docs/paths/petfindbystatus/PetfindbystatusServerInfo.md
docs/paths/petfindbystatus/get/PetfindbystatusGetSecurityInfo.md
Expand All @@ -532,13 +544,18 @@ docs/paths/petfindbystatus/get/Responses.md
docs/paths/petfindbystatus/get/parameters/parameter0/Schema0.md
docs/paths/petfindbystatus/get/responses/Code200Response.md
docs/paths/petfindbystatus/get/responses/Code400Response.md
docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject0.md
docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject1.md
docs/paths/petfindbystatus/get/security/PetfindbystatusGetSecurityRequirementObject2.md
docs/paths/petfindbytags/Get.md
docs/paths/petfindbytags/get/PetfindbytagsGetSecurityInfo.md
docs/paths/petfindbytags/get/QueryParameters.md
docs/paths/petfindbytags/get/Responses.md
docs/paths/petfindbytags/get/parameters/parameter0/Schema0.md
docs/paths/petfindbytags/get/responses/Code200Response.md
docs/paths/petfindbytags/get/responses/Code400Response.md
docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject0.md
docs/paths/petfindbytags/get/security/PetfindbytagsGetSecurityRequirementObject1.md
docs/paths/petpetid/Delete.md
docs/paths/petpetid/Get.md
docs/paths/petpetid/Post.md
Expand All @@ -549,6 +566,8 @@ docs/paths/petpetid/delete/Responses.md
docs/paths/petpetid/delete/parameters/parameter0/Schema0.md
docs/paths/petpetid/delete/parameters/parameter1/Schema1.md
docs/paths/petpetid/delete/responses/Code400Response.md
docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject0.md
docs/paths/petpetid/delete/security/PetpetidDeleteSecurityRequirementObject1.md
docs/paths/petpetid/get/PathParameters.md
docs/paths/petpetid/get/PetpetidGetSecurityInfo.md
docs/paths/petpetid/get/Responses.md
Expand All @@ -558,13 +577,16 @@ docs/paths/petpetid/get/responses/Code400Response.md
docs/paths/petpetid/get/responses/Code404Response.md
docs/paths/petpetid/get/responses/code200response/content/applicationjson/ApplicationjsonSchema.md
docs/paths/petpetid/get/responses/code200response/content/applicationxml/ApplicationxmlSchema.md
docs/paths/petpetid/get/security/PetpetidGetSecurityRequirementObject0.md
docs/paths/petpetid/post/PathParameters.md
docs/paths/petpetid/post/PetpetidPostSecurityInfo.md
docs/paths/petpetid/post/RequestBody.md
docs/paths/petpetid/post/Responses.md
docs/paths/petpetid/post/parameters/parameter0/Schema0.md
docs/paths/petpetid/post/requestbody/content/applicationxwwwformurlencoded/ApplicationxwwwformurlencodedSchema.md
docs/paths/petpetid/post/responses/Code405Response.md
docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject0.md
docs/paths/petpetid/post/security/PetpetidPostSecurityRequirementObject1.md
docs/paths/petpetiduploadimage/Post.md
docs/paths/petpetiduploadimage/post/PathParameters.md
docs/paths/petpetiduploadimage/post/PetpetiduploadimagePostSecurityInfo.md
Expand All @@ -573,13 +595,15 @@ docs/paths/petpetiduploadimage/post/Responses.md
docs/paths/petpetiduploadimage/post/parameters/parameter0/Schema0.md
docs/paths/petpetiduploadimage/post/requestbody/content/multipartformdata/MultipartformdataSchema.md
docs/paths/petpetiduploadimage/post/responses/Code200Response.md
docs/paths/petpetiduploadimage/post/security/PetpetiduploadimagePostSecurityRequirementObject0.md
docs/paths/solidus/Get.md
docs/paths/solidus/get/Responses.md
docs/paths/solidus/get/responses/Code200Response.md
docs/paths/storeinventory/Get.md
docs/paths/storeinventory/get/Responses.md
docs/paths/storeinventory/get/StoreinventoryGetSecurityInfo.md
docs/paths/storeinventory/get/responses/Code200Response.md
docs/paths/storeinventory/get/security/StoreinventoryGetSecurityRequirementObject0.md
docs/paths/storeorder/Post.md
docs/paths/storeorder/post/RequestBody.md
docs/paths/storeorder/post/Responses.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,33 @@ FakeDeleteSecurityInfo.java
public class FakeDeleteSecurityInfo

A class that provides a security requirement object, and any needed security info classes
- an enum class that stores security index values
- a class that stores a securityIndex and provides a SecurityRequirementsObject
- an enum class that describes security index values

## Nested Class Summary
| Modifier and Type | Class and Description |
| ----------------- | --------------------- |
| static class | [FakeDeleteSecurityInfo.FakeDeleteSecurityInfo1](#fakedeletesecurityinfo1)<br>SecurityRequirementObjectProvider
| enum | [FakeDeleteSecurityInfo.SecurityIndex](#securityindex)<br>class that stores a security index |

## FakeDeleteSecurityInfo1
implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)>

### Constructor Summary
| Constructor and Description |
| --------------------------- |
| FakeDeleteSecurityInfo1()<br>Creates an instance |

### Field Summary
| Modifier and Type | Field and Description |
| ----------------- | --------------------- |
| EnumMap<SecurityIndex, SecurityRequirementObject> | securities = new EnumMap<>(Map.ofEntries(<br>&nbsp;&nbsp;&nbsp;&nbsp;new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [FakeDeleteSecurityRequirementObject0()](../../../paths/fake/delete/security/FakeDeleteSecurityRequirementObject0.md)<br>)); |

### Method Summary
| Modifier and Type | Method and Description |
| ----------------- | ---------------------- |
| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)<br>If null is input, then the instance's securityIndex will be used |

## SecurityIndex
enum SecurityIndex<br>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# FakeDeleteSecurityRequirementObject0
FakeDeleteSecurityRequirementObject0.java

public class FakeDeleteSecurityRequirementObject0
extends SecurityRequirementObject

### Constructor Summary
| Constructor and Description |
| --------------------------- |
| FakeDeleteSecurityRequirementObject0()<br>Creates an instance |

### Field Summary
| Modifier and Type | Field and Description |
| ----------------- | --------------------- |
| Map<Class<? extends SecurityScheme>, List<String>> | securitySchemeToScopes = Map.ofEntries(&nbsp;&nbsp;&nbsp;&nbsp;new AbstractMap.SimpleEntry<Class<? extends SecurityScheme>, List<String>>(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[BearerTest.class](../../../../components/securityschemes/BearerTest.md),&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List.of()&nbsp;&nbsp;&nbsp;&nbsp;)) |
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,33 @@ FakePostSecurityInfo.java
public class FakePostSecurityInfo

A class that provides a security requirement object, and any needed security info classes
- an enum class that stores security index values
- a class that stores a securityIndex and provides a SecurityRequirementsObject
- an enum class that describes security index values

## Nested Class Summary
| Modifier and Type | Class and Description |
| ----------------- | --------------------- |
| static class | [FakePostSecurityInfo.FakePostSecurityInfo1](#fakepostsecurityinfo1)<br>SecurityRequirementObjectProvider
| enum | [FakePostSecurityInfo.SecurityIndex](#securityindex)<br>class that stores a security index |

## FakePostSecurityInfo1
implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)>

### Constructor Summary
| Constructor and Description |
| --------------------------- |
| FakePostSecurityInfo1()<br>Creates an instance |

### Field Summary
| Modifier and Type | Field and Description |
| ----------------- | --------------------- |
| EnumMap<SecurityIndex, SecurityRequirementObject> | securities = new EnumMap<>(Map.ofEntries(<br>&nbsp;&nbsp;&nbsp;&nbsp;new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [FakePostSecurityRequirementObject0()](../../../paths/fake/post/security/FakePostSecurityRequirementObject0.md)<br>)); |

### Method Summary
| Modifier and Type | Method and Description |
| ----------------- | ---------------------- |
| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)<br>If null is input, then the instance's securityIndex will be used |

## SecurityIndex
enum SecurityIndex<br>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# FakePostSecurityRequirementObject0
FakePostSecurityRequirementObject0.java

public class FakePostSecurityRequirementObject0
extends SecurityRequirementObject

### Constructor Summary
| Constructor and Description |
| --------------------------- |
| FakePostSecurityRequirementObject0()<br>Creates an instance |

### Field Summary
| Modifier and Type | Field and Description |
| ----------------- | --------------------- |
| Map<Class<? extends SecurityScheme>, List<String>> | securitySchemeToScopes = Map.ofEntries(&nbsp;&nbsp;&nbsp;&nbsp;new AbstractMap.SimpleEntry<Class<? extends SecurityScheme>, List<String>>(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[HttpBasicTest.class](../../../../components/securityschemes/HttpBasicTest.md),&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List.of()&nbsp;&nbsp;&nbsp;&nbsp;)) |
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,33 @@ FakeclassnametestPatchSecurityInfo.java
public class FakeclassnametestPatchSecurityInfo

A class that provides a security requirement object, and any needed security info classes
- an enum class that stores security index values
- a class that stores a securityIndex and provides a SecurityRequirementsObject
- an enum class that describes security index values

## Nested Class Summary
| Modifier and Type | Class and Description |
| ----------------- | --------------------- |
| static class | [FakeclassnametestPatchSecurityInfo.FakeclassnametestPatchSecurityInfo1](#fakeclassnametestpatchsecurityinfo1)<br>SecurityRequirementObjectProvider
| enum | [FakeclassnametestPatchSecurityInfo.SecurityIndex](#securityindex)<br>class that stores a security index |

## FakeclassnametestPatchSecurityInfo1
implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)>

### Constructor Summary
| Constructor and Description |
| --------------------------- |
| FakeclassnametestPatchSecurityInfo1()<br>Creates an instance |

### Field Summary
| Modifier and Type | Field and Description |
| ----------------- | --------------------- |
| EnumMap<SecurityIndex, SecurityRequirementObject> | securities = new EnumMap<>(Map.ofEntries(<br>&nbsp;&nbsp;&nbsp;&nbsp;new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [FakeclassnametestPatchSecurityRequirementObject0()](../../../paths/fakeclassnametest/patch/security/FakeclassnametestPatchSecurityRequirementObject0.md)<br>)); |

### Method Summary
| Modifier and Type | Method and Description |
| ----------------- | ---------------------- |
| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)<br>If null is input, then the instance's securityIndex will be used |

## SecurityIndex
enum SecurityIndex<br>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# FakeclassnametestPatchSecurityRequirementObject0
FakeclassnametestPatchSecurityRequirementObject0.java

public class FakeclassnametestPatchSecurityRequirementObject0
extends SecurityRequirementObject

### Constructor Summary
| Constructor and Description |
| --------------------------- |
| FakeclassnametestPatchSecurityRequirementObject0()<br>Creates an instance |

### Field Summary
| Modifier and Type | Field and Description |
| ----------------- | --------------------- |
| Map<Class<? extends SecurityScheme>, List<String>> | securitySchemeToScopes = Map.ofEntries(&nbsp;&nbsp;&nbsp;&nbsp;new AbstractMap.SimpleEntry<Class<? extends SecurityScheme>, List<String>>(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[ApiKeyQuery.class](../../../../components/securityschemes/ApiKeyQuery.md),&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List.of()&nbsp;&nbsp;&nbsp;&nbsp;)) |
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,33 @@ FakemultiplesecuritiesGetSecurityInfo.java
public class FakemultiplesecuritiesGetSecurityInfo

A class that provides a security requirement object, and any needed security info classes
- an enum class that stores security index values
- a class that stores a securityIndex and provides a SecurityRequirementsObject
- an enum class that describes security index values

## Nested Class Summary
| Modifier and Type | Class and Description |
| ----------------- | --------------------- |
| static class | [FakemultiplesecuritiesGetSecurityInfo.FakemultiplesecuritiesGetSecurityInfo1](#fakemultiplesecuritiesgetsecurityinfo1)<br>SecurityRequirementObjectProvider
| enum | [FakemultiplesecuritiesGetSecurityInfo.SecurityIndex](#securityindex)<br>class that stores a security index |

## FakemultiplesecuritiesGetSecurityInfo1
implements SecurityRequirementObjectProvider<[SecurityIndex](#securityindex)>

### Constructor Summary
| Constructor and Description |
| --------------------------- |
| FakemultiplesecuritiesGetSecurityInfo1()<br>Creates an instance |

### Field Summary
| Modifier and Type | Field and Description |
| ----------------- | --------------------- |
| EnumMap<SecurityIndex, SecurityRequirementObject> | securities = new EnumMap<>(Map.ofEntries(<br>&nbsp;&nbsp;&nbsp;&nbsp;new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_0, new [FakemultiplesecuritiesGetSecurityRequirementObject0()](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject0.md),<br>&nbsp;&nbsp;&nbsp;&nbsp;new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_1, new [FakemultiplesecuritiesGetSecurityRequirementObject1()](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject1.md),<br>&nbsp;&nbsp;&nbsp;&nbsp;new AbstractMap.SimpleEntry<>(SecurityIndex.SECURITY_2, new [FakemultiplesecuritiesGetSecurityRequirementObject2()](../../../paths/fakemultiplesecurities/get/security/FakemultiplesecuritiesGetSecurityRequirementObject2.md)<br>)); |

### Method Summary
| Modifier and Type | Method and Description |
| ----------------- | ---------------------- |
| SecurityRequirementObject | getSecurityRequirementObject(@Nullable [SecurityIndex](#securityindex) securityIndex)<br>If null is input, then the instance's securityIndex will be used |

## SecurityIndex
enum SecurityIndex<br>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# FakemultiplesecuritiesGetSecurityRequirementObject0
FakemultiplesecuritiesGetSecurityRequirementObject0.java

public class FakemultiplesecuritiesGetSecurityRequirementObject0
extends EmptySecurityRequirementObject

### Constructor Summary
| Constructor and Description |
| --------------------------- |
| FakemultiplesecuritiesGetSecurityRequirementObject0()<br>Creates an instance |

### Field Summary
| Modifier and Type | Field and Description |
| ----------------- | --------------------- |
| Map<Class<? extends SecurityScheme>, List<String>> | securitySchemeToScopes = Map.ofEntries() |
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# FakemultiplesecuritiesGetSecurityRequirementObject1
FakemultiplesecuritiesGetSecurityRequirementObject1.java

public class FakemultiplesecuritiesGetSecurityRequirementObject1
extends SecurityRequirementObject

### Constructor Summary
| Constructor and Description |
| --------------------------- |
| FakemultiplesecuritiesGetSecurityRequirementObject1()<br>Creates an instance |

### Field Summary
| Modifier and Type | Field and Description |
| ----------------- | --------------------- |
| Map<Class<? extends SecurityScheme>, List<String>> | securitySchemeToScopes = Map.ofEntries(&nbsp;&nbsp;&nbsp;&nbsp;new AbstractMap.SimpleEntry<Class<? extends SecurityScheme>, List<String>>(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[HttpBasicTest.class](../../../../components/securityschemes/HttpBasicTest.md),&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List.of()&nbsp;&nbsp;&nbsp;&nbsp;),&nbsp;&nbsp;&nbsp;&nbsp;new AbstractMap.SimpleEntry<Class<? extends SecurityScheme>, List<String>>(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[ApiKey.class](../../../../components/securityschemes/ApiKey.md),&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List.of()&nbsp;&nbsp;&nbsp;&nbsp;)) |
Loading

0 comments on commit 06b89d2

Please sign in to comment.