|
|
|
|
@@ -22,7 +22,7 @@ import (
|
|
|
|
|
"github.com/jcmturner/gokrb5/v8/spnego"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func credFetch(server, username string, noKerberos bool, logf func(string, ...interface{})) (*ExecCredential, error) {
|
|
|
|
|
func credFetch(server, username string, noKerberos bool, logf func(string, ...any)) (*ExecCredential, error) {
|
|
|
|
|
url := strings.TrimRight(server, "/") + "/credential"
|
|
|
|
|
|
|
|
|
|
// ── Kerberos SPNEGO ───────────────────────────────────────────────────────
|
|
|
|
|
@@ -58,7 +58,7 @@ func credFetch(server, username string, noKerberos bool, logf func(string, ...in
|
|
|
|
|
return credParse(body)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func credFetchKerberos(url string, logf func(string, ...interface{})) ([]byte, error) {
|
|
|
|
|
func credFetchKerberos(url string, logf func(string, ...any)) ([]byte, error) {
|
|
|
|
|
krb5cfgPath := krb5ConfigPath()
|
|
|
|
|
logf("Kerberos: loading config from %s", krb5cfgPath)
|
|
|
|
|
krb5cfg, err := config.Load(krb5cfgPath)
|
|
|
|
|
@@ -104,7 +104,7 @@ func credFetchKerberos(url string, logf func(string, ...interface{})) ([]byte, e
|
|
|
|
|
return body, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func credFetchBasic(url, username, password string, logf func(string, ...interface{})) ([]byte, error) {
|
|
|
|
|
func credFetchBasic(url, username, password string, logf func(string, ...any)) ([]byte, error) {
|
|
|
|
|
req, err := http.NewRequest(http.MethodGet, url, nil)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, fmt.Errorf("building request: %w", err)
|
|
|
|
|
@@ -166,7 +166,7 @@ func credCacheFile(serverURL string) string {
|
|
|
|
|
return filepath.Join(credCacheDir(), fmt.Sprintf("%x.json", h))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func credReadCache(serverURL string, logf func(string, ...interface{})) (*ExecCredential, bool) {
|
|
|
|
|
func credReadCache(serverURL string, logf func(string, ...any)) (*ExecCredential, bool) {
|
|
|
|
|
path := credCacheFile(serverURL)
|
|
|
|
|
logf("cache: checking %s", path)
|
|
|
|
|
|
|
|
|
|
|