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

Federated Auth #151

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Federated Auth #151

wants to merge 2 commits into from

Conversation

aersam
Copy link
Contributor

@aersam aersam commented Mar 22, 2023

Would fix #135

@aersam
Copy link
Contributor Author

aersam commented Mar 22, 2023

The login packet is where I'm stuck. seems to be quite complicated to get the offsets and so on right

@denisenkom
Copy link
Owner

Thank you for submitting this pull request. I need following in order to merge it:

  1. Did you test this change with actual MSSQL server with this configuration?
  2. Add unit test for that code
  3. Get Appveyor tests to pass

@denisenkom denisenkom mentioned this pull request Mar 23, 2023
@@ -220,6 +221,17 @@ class PacketType:
TDS_FOLEDB = 0x10
TDS_FREADONLY_INTENT = 0x20

# TDS Login Features

Choose a reason for hiding this comment

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

Nit: Feature Extensions

@saurabh500
Copy link

As part of the Feature extension negotiations, SQL server also provides the Audience for which the Access token should be provided, along with bunch of other information. Is it possible to bake that into the APIs, so that the users can use the audience of the token, negotiated with the SQL server? Or do you think that's orthogonal to this PR and I should open a different issue?

@@ -1323,6 +1341,9 @@ def parse_prelogin(self, octets, login):
elif type_id == PreLoginToken.INSTOPT:
# ignore instance name mismatch
pass
elif type_id == PreLoginToken.FEDAUTHREQUIRED:

Choose a reason for hiding this comment

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

I suspect that with this change, even Sql User/Password auth will start erroring out, if the access_token is not set.
You need to check if the payload has a 0 or a 1 value, which are considered valid.
If the server sends a 0x01 AND if the Access_token is set, then only can we send the access token during login negotiation.

@@ -220,6 +221,17 @@ class PacketType:
TDS_FOLEDB = 0x10
TDS_FREADONLY_INTENT = 0x20

# TDS Login Features

Choose a reason for hiding this comment

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

Nit:

Suggested change
# TDS Login Features
# TDS Login Feature Extensions

@bowleri
Copy link

bowleri commented Jul 11, 2024

The login packet is where I'm stuck. seems to be quite complicated to get the offsets and so on right

I have implemented and created #166

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.

Feature Request: Support for token based Authentication for Azure SQL
4 participants