Skip to content

Commit

Permalink
CF support (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
strehle authored Dec 19, 2024
1 parent ef8d0cb commit eab77e9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions openid-client/openid-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"net/http"
"net/url"
"os"
"slices"
"software.sslmate.com/src/go-pkcs12"
"strings"
)
Expand Down Expand Up @@ -109,12 +110,14 @@ func main() {
var skipTlsVerification = flag.Bool("k", false, "Skip TLS server certificate verification")
var mTLS bool = false
var privateKeyJwt string = ""
var arguments []string
if len(os.Args) > 1 && strings.HasPrefix(os.Args[1], "-") == false {
flag.CommandLine.Parse(os.Args[2:])
arguments = os.Args[2:]
*command = os.Args[1]
} else {
flag.CommandLine.Parse(os.Args[1:])
arguments = os.Args[1:]
}
flag.CommandLine.Parse(arguments)
switch *command {
case "jwks":
*issEndPoint = "https://accounts.sap.com"
Expand Down Expand Up @@ -284,6 +287,11 @@ func main() {
requestMap.Set("client_id", *clientID)
if *clientSecret != "" {
requestMap.Set("client_secret", *clientSecret)
} else {
// cf case with an empty secret
if slices.Contains(arguments, "-client_secret") || slices.Contains(arguments, "--client_secret") {
requestMap.Set("client_secret", "")
}
}
if privateKeyJwt != "" {
requestMap.Set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer")
Expand Down

0 comments on commit eab77e9

Please sign in to comment.