Skip to content

Commit

Permalink
Fix type and add error check
Browse files Browse the repository at this point in the history
  • Loading branch information
larsore committed Feb 8, 2025
1 parent ce2b09c commit 67e4e56
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion api/v1alpha1/podtypes/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type CloudSQLProxySettings struct {
//+kubebuilder:validation:Pattern=`^[^:]+:[^:]+:[^:]+$`
ConnectionName string `json:"connectionName,omitempty"`

// Service account used by cloudsql jwtAuth proxy. This service account must have the roles/cloudsql.client role.
// Service account used by cloudsql auth proxy. This service account must have the roles/cloudsql.client role.
//+kubebuilder:validation:Required
ServiceAccount string `json:"serviceAccount,omitempty"`

Expand Down
10 changes: 6 additions & 4 deletions pkg/jwtAuth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func GetAuthConfigsForApplication(k8sClient client.Client, ctx context.Context,
}
}

func (authConfigs AuthConfigs) GetAllowedPaths(authorizationSettings *skiperatorv1alpha1.AuthorizationSettings) []string {
func (authConfigs *AuthConfigs) GetAllowedPaths(authorizationSettings *skiperatorv1alpha1.AuthorizationSettings) []string {
allowPaths := []string{}
if authorizationSettings != nil {
if authorizationSettings.AllowList != nil {
Expand All @@ -99,9 +99,11 @@ func (authConfigs AuthConfigs) GetAllowedPaths(authorizationSettings *skiperator
}
}
}
for _, config := range authConfigs {
if config.NotPaths != nil {
allowPaths = append(allowPaths, *config.NotPaths...)
if authConfigs != nil {
for _, config := range *authConfigs {
if config.NotPaths != nil {
allowPaths = append(allowPaths, *config.NotPaths...)
}
}
}
return allowPaths
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func getJwtValidationAuthPolicy(namespacedName types.NamespacedName, application
},
When: []*securityv1api.Condition{
{
Key: "request.jwtAuth.claims[iss]",
Key: "request.auth.claims[iss]",
Values: []string{authConfig.ProviderURIs.IssuerURI},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func Generate(r reconciliation.Reconciliation) error {
authConfig := r.GetAuthConfigs()

if authConfig == nil {
ctxLog.Debug("No RequestAuthentication to generate. No jwtAuth config provided for", "application", application.Name)
ctxLog.Debug("No RequestAuthentication to generate. No auth config provided for", "application", application.Name)
} else {
requestAuthentication := getRequestAuthentication(application, *authConfig)
r.AddResource(&requestAuthentication)
Expand Down

0 comments on commit 67e4e56

Please sign in to comment.