Skip to content
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

Update credential requirements #13

Merged
merged 1 commit into from
Mar 6, 2024
Merged

Update credential requirements #13

merged 1 commit into from
Mar 6, 2024

Conversation

jborean93
Copy link
Owner

Update the documentation that specifies a credential MUST be specified when creating a security context. This is technically a breaking change but it should be a minimal one.

I've done a search on github for any users of this library and could not find any situations where the change in positional arguments would cause any issues. That doesn't rule it out completely but I'm fairly confident this should be a minimally impacted change. To have code that works with both then using the keyword in the constructor will work with both for example:

sspilib.ClientSecurityContext(credential=cred)

Fixes: #11

Comment on lines 343 to 344
credential: A credential to use for authentication, defaults to the
current user context if not set.
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no defaulting anymore.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Thanks for the pickup, has been updated.

@jborean93 jborean93 force-pushed the credential branch 2 times, most recently from d2dceb9 to fd0c16b Compare March 6, 2024 01:17
Update the documentation that specifies a credential MUST be specified
when creating a security context. This is technically a breaking change
but it should be a minimal one.
@jborean93 jborean93 merged commit d41025d into main Mar 6, 2024
28 checks passed
@jborean93 jborean93 deleted the credential branch March 6, 2024 03:21
channel_bindings: Optional channel bindings to tie the context to.
"""

def __init__(
self,
credential: raw.CredHandle,
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I did not catch this earlier, but placing credential after target_name is probably a less disruptive change. target_name was a single required argument, so in my code I had ClientSecurityContext(spn, credential=UserCredential()), which will be broken by this change. I now updated to ClientSecurityContext(target_name=spn, credential=UserCredential()), but making credential the second argument would work without any changes.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yea I did consider this and found that having it first aligns this with the server context object and as it was already a breaking change and I couldn't find any active examples that used the failing way in GitHub search I decided to just go with it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Which is actually the only use I've found outside of this repo :)

Copy link
Owner Author

Choose a reason for hiding this comment

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

Thanks for finding that, I'll submit a PR to use the syntax that will work with both versions. I prefer to keep it consistent especially in the early stages of this project and in IMO people would probably expect the credentials to be the first thing they would supply.

Copy link
Owner Author

Choose a reason for hiding this comment

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

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.

Failure when ClientSecurityContext used without credentials
2 participants