Skip to content

Commit

Permalink
Renamed function and siplified if-statement
Browse files Browse the repository at this point in the history
  • Loading branch information
larsore committed Feb 9, 2025
1 parent 22bf348 commit 758a1c8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions pkg/jwtAuth/authConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@ func GetAuthConfigsForApplication(k8sClient client.Client, ctx context.Context,

func (authConfigs *AuthConfigs) GetAllowedPaths(authorizationSettings *skiperatorv1alpha1.AuthorizationSettings) []string {
var allowPaths []string
if authorizationSettings != nil {
if authorizationSettings.AllowList != nil {
if len(authorizationSettings.AllowList) > 0 {
allowPaths = authorizationSettings.AllowList
}
}
if authorizationSettings != nil && authorizationSettings.AllowList != nil && len(authorizationSettings.AllowList) > 0 {
allowPaths = authorizationSettings.AllowList
}
if authConfigs != nil {
for _, config := range *authConfigs {
Expand Down
2 changes: 1 addition & 1 deletion pkg/jwtAuth/maskinporten.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (i *MaskinportenOps) GetSecret(k8sClient client.Client, ctx context.Context
return &secret, nil
}
namespacedName.Name = application.Name
maskinportenClient, err := util.GetMaskinPortenlient(k8sClient, ctx, namespacedName)
maskinportenClient, err := util.GetMaskinportenClient(k8sClient, ctx, namespacedName)
if err != nil {
return nil, fmt.Errorf("failed to get MaskinportenClient: %s", namespacedName.String())
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/helperfunctions.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func GetIdPortenClient(k8sClient client.Client, ctx context.Context, namespacedN
return idPortenClient, nil
}

func GetMaskinPortenlient(k8sClient client.Client, ctx context.Context, namespacedName types.NamespacedName) (*nais_io_v1.MaskinportenClient, error) {
func GetMaskinportenClient(k8sClient client.Client, ctx context.Context, namespacedName types.NamespacedName) (*nais_io_v1.MaskinportenClient, error) {
maskinPortenClient := &nais_io_v1.MaskinportenClient{}
if err := k8sClient.Get(ctx, namespacedName, maskinPortenClient); err != nil {
if errors.IsNotFound(err) {
Expand Down

0 comments on commit 758a1c8

Please sign in to comment.