mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2026-10-17 11:55:38 +02:00
revert: secrets as []byte instead of string
Signed-off-by: Jan Larwig <jan@larwig.com>
This commit is contained in:
@@ -9,12 +9,12 @@ import (
|
||||
)
|
||||
|
||||
var _ = Describe("Common", func() {
|
||||
var validSecretSourceValue string
|
||||
var validSecretSourceValue []byte
|
||||
const validSecretSourceEnv = "OAUTH2_PROXY_TEST_SECRET_SOURCE_ENV"
|
||||
var validSecretSourceFile string
|
||||
|
||||
BeforeEach(func() {
|
||||
validSecretSourceValue = "This is a secret source value"
|
||||
validSecretSourceValue = []byte("This is a secret source value")
|
||||
Expect(os.Setenv(validSecretSourceEnv, "This is a secret source env")).To(Succeed())
|
||||
tmp, err := os.CreateTemp("", "oauth2-proxy-secret-source-test")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
@@ -51,9 +51,11 @@ func validateHeaderValue(_ string, value options.HeaderValue) []string {
|
||||
|
||||
func validateHeaderValueClaimSource(claim options.ClaimSource) []string {
|
||||
msgs := []string{}
|
||||
|
||||
if claim.Claim == "" {
|
||||
msgs = append(msgs, "claim should not be empty")
|
||||
}
|
||||
|
||||
if claim.BasicAuthPassword != nil {
|
||||
msgs = append(msgs, prefixValues("invalid basicAuthPassword: ", validateSecretSource(*claim.BasicAuthPassword))...)
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ var _ = Describe("Headers", func() {
|
||||
Values: []options.HeaderValue{
|
||||
{
|
||||
SecretSource: &options.SecretSource{
|
||||
Value: base64.StdEncoding.EncodeToString([]byte("secret")),
|
||||
Value: []byte(base64.StdEncoding.EncodeToString([]byte("secret"))),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -43,7 +43,7 @@ var _ = Describe("Headers", func() {
|
||||
ClaimSource: &options.ClaimSource{
|
||||
Claim: "email",
|
||||
BasicAuthPassword: &options.SecretSource{
|
||||
Value: base64.StdEncoding.EncodeToString([]byte("secret")),
|
||||
Value: []byte(base64.StdEncoding.EncodeToString([]byte("secret"))),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user