Skip to content

Add initial AuthSchemeProvider codegen #4025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

gosar
Copy link
Contributor

@gosar gosar commented May 19, 2023

Motivation and Context

Modifications

This includes:

  • AuthSchemeParams interface and implementation.
  • AuthSchemeProvider interface
  • AuthSchemeProvider implementation is stubbed out for now.
  • Plumbing to generate authscheme related code

First I'd like to get feedback on whether the generated code itself looks good and the general setup of everything. There are some TODO: reviewer questions.

Second, if there are suggestions to improve the code within the Spec classes, lmk.

Note

This assumes that the service has model-based resolvers, which is most of AWS service, except S3 and EventBridge. Special handling for those 2 services will be added in separate PRs.

Testing

Added codegen tests for each file.
Ran ./mvnw clean install -pl :codegen,:s3 to confirm generated code builds within real service module.

@gosar gosar requested a review from a team as a code owner May 19, 2023 08:32
This includes:
* AuthSchemeParams interface and implementation.
* AuthSchemeProvider interface
* AuthSchemeProvider implementation is stubbed out for now.
* Plumbing to generate authscheme related code
@gosar gosar force-pushed the gosar/sra-ia-authScheme-service-interfaces branch from 247ec75 to d843a6f Compare May 19, 2023 08:36
@gosar gosar requested a review from L-Applin May 23, 2023 05:42
gosar added 2 commits May 23, 2023 12:20
This is needed for setting authSchemeProvider client configuration option.
@@ -70,6 +70,9 @@ public final class Constant {

public static final String PACKAGE_NAME_RULES_PATTERN = "%s.endpoints";

// TODO: reviewer: maybe just auth instead of authscheme? or auth.scheme?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my.service.package.name.auth.authscheme is also another option that sounds good to me. Does it make sense to have authscheme a sub-package of the auth package?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like auth as prefix

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use .auth.scheme.

.addParameter(ParameterSpec.builder(String.class, "region").build())
.returns(authSchemeSpecUtils.parametersInterfaceBuilderInterfaceName())
.addJavadoc("Set the region. The region parameter may be used with the $S auth scheme.",
"aws.auth#sigv4") // TODO: Could the known auth schemes be defined somewhere?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're not exposing the auth scheme id (slightly unsure), do we need to reference it? Can we reference the AuthScheme class for Sigv4 instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they can be considered public. I used it in the javadoc for HttpAuthScheme. Good point about using the AuthScheme class. It doesn't exist yet. So will keep the TODO to update when that exists.

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug C 4 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 103 Code Smells

72.8% 72.8% Coverage
2.0% 2.0% Duplication

@gosar gosar merged commit 39a22b2 into feature/master/sra-identity-auth May 24, 2023
@gosar gosar deleted the gosar/sra-ia-authScheme-service-interfaces branch May 24, 2023 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants