-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
383 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
a6a317df8327c9b1e5cb59a03a42ffa2aabeef6d | ||
1668b0db17e23605f8c9d29fb3b674c01590732d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: "CodeQL Advanced" | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
schedule: | ||
- cron: '41 1 * * 0' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze (${{ matrix.language }}) | ||
runs-on: | ||
group: databricks-deco-testing-runner-group | ||
labels: ubuntu-latest-deco | ||
permissions: | ||
# required for all workflows | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- language: go | ||
build-mode: autobuild | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v3 | ||
with: | ||
languages: ${{ matrix.language }} | ||
build-mode: ${{ matrix.build-mode }} | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v3 | ||
with: | ||
category: "/language:${{matrix.language}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package credentials | ||
|
||
import ( | ||
"net/http" | ||
|
||
"golang.org/x/oauth2" | ||
) | ||
|
||
// CredentialsProvider is an interface for providing credentials to the client. | ||
// Implementations of this interface should set the necessary headers on the request. | ||
type CredentialsProvider interface { | ||
// SetHeaders sets the necessary headers on the request. | ||
SetHeaders(r *http.Request) error | ||
} | ||
|
||
type credentialsProvider struct { | ||
setHeaders func(r *http.Request) error | ||
} | ||
|
||
func (c *credentialsProvider) SetHeaders(r *http.Request) error { | ||
return c.setHeaders(r) | ||
} | ||
|
||
func NewCredentialsProvider(visitor func(r *http.Request) error) CredentialsProvider { | ||
return &credentialsProvider{ | ||
setHeaders: visitor, | ||
} | ||
} | ||
|
||
// OAuthCredentialsProvider is a specialized CredentialsProvider uses and provides an OAuth token. | ||
type OAuthCredentialsProvider interface { | ||
CredentialsProvider | ||
// Token returns the OAuth token generated by the provider. | ||
Token() (*oauth2.Token, error) | ||
} | ||
|
||
type oauthCredentialsProvider struct { | ||
setHeaders func(r *http.Request) error | ||
token func() (*oauth2.Token, error) | ||
} | ||
|
||
func (c *oauthCredentialsProvider) SetHeaders(r *http.Request) error { | ||
return c.setHeaders(r) | ||
} | ||
|
||
func (c *oauthCredentialsProvider) Token() (*oauth2.Token, error) { | ||
return c.token() | ||
} | ||
|
||
func NewOAuthCredentialsProvider(visitor func(r *http.Request) error, tokenProvider func() (*oauth2.Token, error)) OAuthCredentialsProvider { | ||
return &oauthCredentialsProvider{ | ||
setHeaders: visitor, | ||
token: tokenProvider, | ||
} | ||
} | ||
|
||
// OAuthToken represents an OAuth token as defined by the OAuth 2.0 Authorization Framework. | ||
// https://datatracker.ietf.org/doc/html/rfc6749 | ||
type OAuthToken struct { | ||
// The access token issued by the authorization server. This is the token that will be used to authenticate requests. | ||
AccessToken string `json:"access_token" auth:",sensitive"` | ||
// Time in seconds until the token expires. | ||
ExpiresIn int `json:"expires_in"` | ||
// The scope of the token. This is a space-separated list of strings that represent the permissions granted by the token. | ||
Scope string `json:"scope"` | ||
// The type of token that was issued. | ||
TokenType string `json:"token_type"` | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.