-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
APIGOV-24312 - Support for using additional auth when communicating t…
…o IdP (#672) * APIGOV-24312 - Added support for using additional auth when communicating to IdP - Changes to configure the agents to use client_secret_basic, client_secret_post, client_secret_jwt, private_key_jwt, tls_client_auth and self_signed_tls_client_auth - Changes to acquire token based for the registered IdP provider on the configured auth types * APIGOV-24312 - Fix tests * APIGOV-24312 - IDP auth config validation * APIGOV-24312 - Code review comments + fix for accessToken IdP auth type
- Loading branch information
1 parent
94d6a36
commit 9b23096
Showing
16 changed files
with
528 additions
and
183 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
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,28 @@ | ||
package oauth | ||
|
||
import ( | ||
"encoding/base64" | ||
"net/url" | ||
) | ||
|
||
type clientSecretBasicAuthenticator struct { | ||
clientID string | ||
clientSecret string | ||
scope string | ||
} | ||
|
||
func (p *clientSecretBasicAuthenticator) prepareRequest() (url.Values, map[string]string, error) { | ||
v := url.Values{ | ||
metaGrantType: []string{grantClientCredentials}, | ||
} | ||
|
||
if p.scope != "" { | ||
v.Add(metaScope, p.scope) | ||
} | ||
|
||
token := base64.StdEncoding.EncodeToString([]byte(p.clientID + ":" + p.clientSecret)) | ||
headers := map[string]string{ | ||
"Authorization": "Basic " + token, | ||
} | ||
return v, headers, nil | ||
} |
Oops, something went wrong.