[Spring] Add clientRegistrationId option for OAuth2 HTTP Interface
Merged
NG
6mo ago+9393+9393+0123456789012345678901234567890123456789-0-0-0123456789
Summary
Adds support for generating Spring HTTP Interface clients with the @ClientRegistrationId annotation to enable OAuth2 with Spring Security.
Changes
- Add
clientRegistrationIdadditional property and CLI option toSpringCodegen - Update
spring-http-interfacetemplate to import and apply@ClientRegistrationIdon the interface when set - Add unit tests for the new option
- Include a sample config and generated sample demonstrating usage
Generated Code Example
@ClientRegistrationId("petstore-oauth")
public interface PetApi {
@HttpExchange(
method = "GET",
value = "/pet/{petId}",
accept = { "application/json" }
)
ResponseEntity<PetDto> getPetById(@PathVariable("petId") Long petId);
}
PR checklist
- Read the contribution guidelines.
- Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work.
- Run the following to build the project and update samples. Commit all changed files.
- File the PR against the correct branch:
master - @mention the technical committee members
Java Spring Technical Committee: @cachescrubber @welshm @MelleD @atextor @manedev79 @javisst @borsch @banlevente @Zomzog @martin-mfg