mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 11:08:10 +00:00
Add base_url option to GitHub auth provider to allow selecting a custom endpoint. Fixes #572.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package github
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
||||
"github.com/google/go-github/github"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
"github.com/hashicorp/vault/logical/framework"
|
||||
@@ -39,6 +42,14 @@ func (b *backend) pathLogin(
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if config.BaseURL != "" {
|
||||
parsedURL, err := url.Parse(config.BaseURL)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Successfully parsed base_url when set but failing to parse now: %s", err)
|
||||
}
|
||||
client.BaseURL = parsedURL
|
||||
}
|
||||
|
||||
// Get the user
|
||||
user, _, err := client.Users.Get("")
|
||||
if err != nil {
|
||||
@@ -108,7 +119,6 @@ func (b *backend) pathLogin(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
policiesList, err := b.Map.Policies(req.Storage, teamNames...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user