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

Initial oauth implementation #122

Merged
merged 6 commits into from
Sep 5, 2023

Conversation

rcypher-databricks
Copy link
Contributor

@rcypher-databricks rcypher-databricks commented Apr 25, 2023

Oauth implementation.
Added m2m authenticator.
Added basic u2m authenticator. Implementation is broken out into public functions that clients can use to implement their own authenticator.
Allow specifying auth type and parameters in dsn.

@scottlepp
Copy link
Contributor

Hi @rcypher-databricks this would be a great feature. I see it's still in draft. Curious if it's close to merge?

@rcypher-databricks
Copy link
Contributor Author

Hi @rcypher-databricks this would be a great feature. I see it's still in draft. Curious if it's close to merge?

Hi Scott, the plan is to get back to oauth next week. So hopefully in the next 2 weeks we'll get something released

}
} else {
if !hasScope(scopes, "sql") {
scopes = append(scopes, "sql")
Copy link
Contributor

Choose a reason for hiding this comment

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

should we use sql or all-apis? Gotta check with Bryan Mcquade

connector, err := dbsql.NewConnector(
dbsql.WithServerHostname(os.Getenv("DATABRICKS_HOST")),
dbsql.WithHTTPPath(os.Getenv("DATABRICKS_HTTPPATH")),
dbsql.WithDefaultOAUTH(),
Copy link
Contributor

Choose a reason for hiding this comment

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

OAUTH is Oauth

@@ -14,7 +14,8 @@ import (

"github.com/databricks/databricks-sql-go/auth"
"github.com/databricks/databricks-sql-go/auth/noop"
"github.com/databricks/databricks-sql-go/auth/pat"
"github.com/databricks/databricks-sql-go/internal/auth/oauth/defauth"
"github.com/databricks/databricks-sql-go/internal/auth/pat"
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a breaking change!

Signed-off-by: Raymond Cypher <raymond.cypher@databricks.com>
Fixed error in default authenticator where it tried to register the same http handler multiple times.
Added config decorator functions WithDefaultOAUTH, WithClientCredentials
Signed-off-by: Raymond Cypher <raymond.cypher@databricks.com>
Moved implementation out of internal.
Allow specifying auth type and parameters in dsn string.
Refactored dsn parsing.
Added tests to dsn parsing.
Change default authenticator back to Noop
Signed-off-by: Raymond Cypher <raymond.cypher@databricks.com>
Updated doc.go with new dsn parameters and connector functions.
Signed-off-by: Raymond Cypher <raymond.cypher@databricks.com>
Signed-off-by: Raymond Cypher <raymond.cypher@databricks.com>
Signed-off-by: Raymond Cypher <raymond.cypher@databricks.com>
@rcypher-databricks rcypher-databricks merged commit 34599c4 into databricks:main Sep 5, 2023
3 checks passed
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.

3 participants