Skip to content

api, auth: add CallCredentials.allowedSecurityLevel() helper - #13056

Open
AgraVator wants to merge 2 commits into
grpc:masterfrom
AgraVator:callcredentials-allowed-security-level
Open

AgraVator wants to merge 2 commits into
grpc:masterfrom
AgraVator:callcredentials-allowed-security-level

Conversation

@AgraVator

Copy link
Copy Markdown
Contributor

Adds a protected static helper on CallCredentials.

GoogleAuthLibraryCallCredentials is updated to use it. Behavior there is unchanged: it previously compared against PRIVACY_AND_INTEGRITY for exact equality, which is equivalent to a >= comparison since PRIVACY_AND_INTEGRITY is the highest security level.

This revives #6616, which was reviewed and approved but went stale because the CLA was never signed. Credit for the original change goes to @yihuazhang. Relative to that PR:

  • the method is protected rather than public, per @ejona86's last review comment;
  • the javadoc points at the merged gRFC L62 document rather than the then-open proposal PR;
  • GoogleAuthLibraryCallCredentialsTest already covered the PRIVACY_AND_INTEGRITY and INTEGRITY levels, so a case for NONE is added to complete coverage of the changed line;
  • the xds FileBasedPluginCredential change is dropped, as agreed in the original review.

Add a protected helper on CallCredentials so that implementations can
check whether the transport's security level meets the minimum level
they require before transferring credentials, as described in gRFC L62.

Use it in GoogleAuthLibraryCallCredentials, which previously compared
against PRIVACY_AND_INTEGRITY for exact equality. The behavior is
unchanged, since PRIVACY_AND_INTEGRITY is the highest security level.

Supersedes grpc#6616, which was approved but went stale.
Drop the newly added CallCredentialsTest in favor of extending the
pre-existing GoogleAuthLibraryCallCredentialsTest, which already
exercises the helper through the real code path. It covered
PRIVACY_AND_INTEGRITY and INTEGRITY; add the remaining NONE case.
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.

1 participant