Skip to content

Commit

Permalink
Merge pull request #3578 from mevan-karu/test-key
Browse files Browse the repository at this point in the history
Introduce temporary configs to support multiple headers for the Console testing
  • Loading branch information
renuka-fernando authored Sep 9, 2024
2 parents 3c16d97 + cf6fc4f commit 3cd7bcc
Show file tree
Hide file tree
Showing 15 changed files with 500 additions and 22 deletions.
10 changes: 6 additions & 4 deletions adapter/config/default_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ var defaultConfig = &Config{
},
Retry: upstreamRetry{
MaxRetryCount: 5,
RetryOn: "connect-failure",
RetryOn: "connect-failure",
BaseInterval: 25 * time.Millisecond,
MaxInterval: 500 * time.Millisecond,
StatusCodes: []uint32{504},
Expand Down Expand Up @@ -202,9 +202,11 @@ var defaultConfig = &Config{
},
},
AuthHeader: authHeader{
EnableOutboundAuthHeader: false,
AuthorizationHeader: "authorization",
TestConsoleHeaderName: "Internal-Key",
EnableOutboundAuthHeader: false,
AuthorizationHeader: "authorization",
TestConsoleHeaderName: "Internal-Key",
TempTestConsoleHeaderNames: []string{},
TempTestConsoleHeadersMode: "monitor",
},
},
AuthService: authService{
Expand Down
8 changes: 5 additions & 3 deletions adapter/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,11 @@ type analyticsEnforcer struct {
}

type authHeader struct {
EnableOutboundAuthHeader bool
AuthorizationHeader string
TestConsoleHeaderName string
EnableOutboundAuthHeader bool
AuthorizationHeader string
TestConsoleHeaderName string
TempTestConsoleHeaderNames []string
TempTestConsoleHeadersMode string
}

type jwtIssuer struct {
Expand Down
8 changes: 5 additions & 3 deletions adapter/internal/discovery/xds/marshaller.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,11 @@ func MarshalConfig(config *config.Config) *enforcer.Config {
Security: &enforcer.Security{
TokenService: issuers,
AuthHeader: &enforcer.AuthHeader{
EnableOutboundAuthHeader: config.Enforcer.Security.AuthHeader.EnableOutboundAuthHeader,
AuthorizationHeader: config.Enforcer.Security.AuthHeader.AuthorizationHeader,
TestConsoleHeaderName: config.Enforcer.Security.AuthHeader.TestConsoleHeaderName,
EnableOutboundAuthHeader: config.Enforcer.Security.AuthHeader.EnableOutboundAuthHeader,
AuthorizationHeader: config.Enforcer.Security.AuthHeader.AuthorizationHeader,
TestConsoleHeaderName: config.Enforcer.Security.AuthHeader.TestConsoleHeaderName,
TempTestConsoleHeaderNames: config.Enforcer.Security.AuthHeader.TempTestConsoleHeaderNames,
TempTestConsoleHeadersMode: config.Enforcer.Security.AuthHeader.TempTestConsoleHeadersMode,
},
},
Cache: cache,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions api/proto/wso2/discovery/config/enforcer/auth_header.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ message AuthHeader {
string authorizationHeader = 2;

string testConsoleHeaderName = 3;

repeated string tempTestConsoleHeaderNames = 4;

string tempTestConsoleHeadersMode = 5;
}
Loading

0 comments on commit 3cd7bcc

Please sign in to comment.