Skip to content

Add new Identity interfaces #3773

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

Merged
merged 7 commits into from
Mar 4, 2023

Conversation

gosar
Copy link
Contributor

@gosar gosar commented Feb 17, 2023

Motivation and Context

As part of Smithy Reference Architecture, we are defining new Identity and Auth components. This changes adds the new Identity interfaces.

Modifications

This changes adds the new Identity interfaces and related changes to existing interfaces to be sub-types of the new interfaces, to maintain backwards compatibility.
Changes to ClientBuilders and other classes to use the new interfaces will be in separate PR next.

Testing

No specific new tests. Made sure build succeeds. ./mvnw clean install -pl :identity-spi,:auth -am

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@gosar gosar requested a review from millems February 17, 2023 23:37

@Immutable
@SdkInternalApi
final class AwsCredentialsIdentityImpl implements AwsCredentialsIdentity {
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't seen any mention in the design doc of a direct implementation of AwsCredentialsIdentity. Do we need this class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to support the static create methods in AwsCredentialsIdentity which are called out in the design doc. Cannot use the existing AwsBasicCredentials as that would be a circular dependency, so defined copies of them here as @SdkInternalApi and package-private.

Copy link
Contributor

Choose a reason for hiding this comment

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

We're also discussing offline, but if we do decide to keep them they should be in an internal subpackage

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd vote for removing those classes. They are implementation details and we'd need to maintain two copies of the same implementations. We could consider creating a factory class in auth module that makes it easier for people to create static credentials.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 removed for now.

gosar added 3 commits March 1, 2023 22:18
Was getting these errors otherwise:
```
[ERROR] Failed to execute goal com.github.siom79.japicmp:japicmp-maven-plugin:0.15.6:cmp (default) on project auth: There is at least one incompatibility: software.amazon.awssdk.auth.credentials.AwsCredentials.accessKeyId():METHOD_REMOVED,software.amazon.awssdk.auth.credentials.AwsCredentials.secretAccessKey():METHOD_REMOVED,software.amazon.awssdk.auth.token.credentials.SdkToken.expirationTime():METHOD_REMOVED,software.amazon.awssdk.auth.token.credentials.SdkToken.token():METHOD_REMOVED -> [Help 1]
```
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 3, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

42.6% 42.6% Coverage
0.0% 0.0% Duplication

@gosar gosar marked this pull request as ready for review March 4, 2023 00:02
@gosar gosar requested a review from a team as a code owner March 4, 2023 00:03
@gosar gosar merged commit ac838e0 into feature/master/sra-identity-auth Mar 4, 2023

@Override
public int hashCode() {
return 31 + Objects.hashCode(properties);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be 32 * Objects.hashCode(properties); instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, 31 * ..., i.e., not +.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I think since there is only 1 field in this class, I can just return Objects.hashCode(properties);. Will update in new PR as this is merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updating in #3814

@gosar gosar mentioned this pull request Mar 6, 2023
12 tasks
gosar added a commit that referenced this pull request Mar 9, 2023
* Simplify hashCode and equals for ResolveIdentityRequest

* Fix doc link about AWS access keys

To match with updates to `AwsCredentials` in PR 3773.
@gosar gosar deleted the gosar/sra-ia-identity branch April 1, 2023 00:02
@@ -630,6 +630,10 @@
<exclude>software.amazon.awssdk.core.signer.NoOpSigner</exclude>
<exclude>software.amazon.awssdk.auth.credentials.ProfileCredentialsProviderFactory</exclude>
<exclude>software.amazon.awssdk.utils.async.InputStreamSubscriber</exclude>

<!-- Moving the interface methods to new SRA super interfaces causes japicmp to complain -->
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the errors without this are:

[ERROR] Failed to execute goal com.github.siom79.japicmp:japicmp-maven-plugin:0.15.6:cmp (default) on project auth: There is at least one incompatibility: software.amazon.awssdk.auth.credentials.AwsCredentials.accessKeyId():METHOD_REMOVED,software.amazon.awssdk.auth.credentials.AwsCredentials.secretAccessKey():METHOD_REMOVED,software.amazon.awssdk.auth.token.credentials.SdkToken.expirationTime():METHOD_REMOVED,software.amazon.awssdk.auth.token.credentials.SdkToken.token():METHOD_REMOVED -> [Help 1]

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.

4 participants