Skip to content

[Service Bus Client] Shared Access Key Credential#16085

Merged
jsquire merged 1 commit intoAzure:masterfrom
jsquire:servicebus/credential
Oct 23, 2020
Merged

[Service Bus Client] Shared Access Key Credential#16085
jsquire merged 1 commit intoAzure:masterfrom
jsquire:servicebus/credential

Conversation

@jsquire
Copy link
Copy Markdown
Member

@jsquire jsquire commented Oct 19, 2020

Summary

The focus of these changes is to implement the ServiceBusSharedAccessKeyCredential, allowing SAS tokens and shared keys to be used without a connection string.

Note: These changes have been reviewed and approved by the architecture board and the .NET language architect. Marking with the corresponding tag for tracking purposes.

Last Upstream Rebase

Monday, October 19, 1:34pm (EDT)

References

@jsquire
Copy link
Copy Markdown
Member Author

jsquire commented Oct 19, 2020

/azp run net - servicebus - tests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Member

@tg-msft tg-msft left a comment

Choose a reason for hiding this comment

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

I'd like to align a little more with other credentials.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should split this into two types like we do with other key/signature credentials.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you provide pointers to the other credentials you are referring to here? Is the reason that one wouldn't think of using this credential if all they had was the signature (because the name says "key")? Would a rename then help? ServiceBusSharedAccessCredential? ServiceBusSharedAccessPolicyCredential?

Copy link
Copy Markdown
Member Author

@jsquire jsquire Oct 19, 2020

Choose a reason for hiding this comment

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

I'm not sure that I understand what the benefit to developers using the library would be in splitting this. As these are elements that are often sibling concepts within a connection string, there is precedent for their association. I would strongly prefer to avoid introducing another constructor overload or two additional public types (base class, other credential) into an already crowded space.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Storage has a StorageSharedKeyCredential and we're looking at StorageSharedAccessSignatureCredential to match EventGrid's. And the benefit to splitting it is make auth, a historically difficult topic, as clear as possible.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This one I do feel strongly about. I don't believe that splitting this offers greater usability, and I do believe that the additional types and overloads degrade it. This, I'd very much like to push back on.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why are the Key and Signature public? We should keep them internal.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fair point..
@jsquire Other than giving the user the ability to check what the current value of their key/signature is if they were ever rotating them, is there any other reason to have these public? Is there a security angle here where we would not want to make them public to avoid the case of this info getting logged accidentally?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The intent is to allow inspection by callers holding the token, as context for making the decision of "is this using the latest information or do I need to rotate" as well as debugging authorization failures by understanding the same context.

What would the benefit of hiding this information from developers using the library?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We've done this for other credentials because although it's not a security issue, we want customers to be thoughtful about how they manage their secrets and we make it inconvenient to read this info from our types.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't agree with the rationale, but I don't feel strongly enough to push back on it. I'm comfortable deferring to @ramya-rao-a , assuming that @tg-msft has cleared this with @KrzysztofCwalina.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not just Update to match everyone else?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you share who everyone else is here? Are you suggesting a single Update method instead of two?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

At one point we had considered a single update method with an overload; if I recall, there was some concern that callers may be confused and the consensus was that having the name explicitly reflect the intent was more clear.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps @tg-msft is referring to AzureKeyCredential?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is also StorageSharedKeyCredential, though the method is called SetAccountKey.

Copy link
Copy Markdown
Member Author

@jsquire jsquire Oct 19, 2020

Choose a reason for hiding this comment

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

It appears as if AzureKeyCredential is intended for API Key scenarios rather than SAS-type scenarios, based on samples that use it. For example, Azure.Search and Text Analytics

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We called it SetAccountKey in Storage first and then decided we'd be doing Update for all other credentials. And you have a shared key here so you're doing the same.

Copy link
Copy Markdown
Member Author

@jsquire jsquire Oct 19, 2020

Choose a reason for hiding this comment

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

I don't feel strongly here, though I do tend to favor the explicit naming. I'm comfortable deferring to @ramya-rao-a, assuming that @tg-msft has cleared this with @KrzysztofCwalina.

@jsquire
Copy link
Copy Markdown
Member Author

jsquire commented Oct 19, 2020

I'd like to align a little more with other credentials.

This design was the result of several rounds of conversation, feedback, and revision across the feature team, service team, and language architects. As this form was agreed upon by those parties, I'm going to respectfully decline reopening design discussions.

The focus of these changes is to implement the `ServiceBusSharedAccessKeyCredential`,
allowing SAS tokens and shared keys to be used without a connection string.
@jsquire jsquire force-pushed the servicebus/credential branch from 1bacce6 to 09d146f Compare October 19, 2020 19:29
@jsquire
Copy link
Copy Markdown
Member Author

jsquire commented Oct 23, 2020

Per offline conversations, I'm going to merge this in and we'll adjust based on the pending architecture board discussions in a separate work stream.

@jsquire jsquire merged commit 0947a96 into Azure:master Oct 23, 2020
@jsquire jsquire deleted the servicebus/credential branch October 23, 2020 12:36
annelo-msft pushed a commit to annelo-msft/azure-sdk-for-net that referenced this pull request Feb 17, 2021
The focus of these changes is to implement the `ServiceBusSharedAccessKeyCredential`,
allowing SAS tokens and shared keys to be used without a connection string.
openapi-sdkautomation Bot pushed a commit to AzureSDKAutomation/azure-sdk-for-net that referenced this pull request Sep 22, 2021
[Device Update for IoT Hub] Added Private Endpoint Connection API and model definitions (Azure#16085)

* Added Private Endpoint Connection API and model definitions, fixed minor errors

* Referenced common private link types

* Reference list types do not have nextLink property

* Fixed copy&paste description error

* Trying to suppress an error

* Change common types version to v3

* Suppression not working

* Extended common type in order to add a required property
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Client This issue is related to a non-management package Service Bus

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants