mirror of
https://github.com/minio/minio.git
synced 2025-01-23 20:53:18 -05:00
fix: allow authToken for webhook to support Splunk (#12663)
This commit is contained in:
parent
d6a2fe02d3
commit
bab72f6887
@ -30,6 +30,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/minio/minio/internal/event"
|
"github.com/minio/minio/internal/event"
|
||||||
@ -163,7 +164,15 @@ func (target *WebhookTarget) send(eventData event.Event) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if target.args.AuthToken != "" {
|
// Verify if the authToken already contains
|
||||||
|
// <Key> <Token> like format, if this is
|
||||||
|
// already present we can blindly use the
|
||||||
|
// authToken as is instead of adding 'Bearer'
|
||||||
|
tokens := strings.Fields(target.args.AuthToken)
|
||||||
|
switch len(tokens) {
|
||||||
|
case 2:
|
||||||
|
req.Header.Set("Authorization", target.args.AuthToken)
|
||||||
|
case 1:
|
||||||
req.Header.Set("Authorization", "Bearer "+target.args.AuthToken)
|
req.Header.Set("Authorization", "Bearer "+target.args.AuthToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user