Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APPS-1400 Remove EXTERNAL_INSECURE auth mode #290

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -689,12 +689,10 @@ Validation allows only one of these three fields to be present.
properties:
auth-mode:
description: >-
The authentication mode string (INTERNAL, EXTERNAL,
EXTERNAL_INSECURE, PKI).
The authentication mode string (INTERNAL, EXTERNAL, PKI).
enum:
- INTERNAL
- EXTERNAL
- EXTERNAL_INSECURE
- PKI
type: string
password:
Expand Down
3 changes: 1 addition & 2 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2030,12 +2030,11 @@ const docTemplate = `{
"type": "object",
"properties": {
"auth-mode": {
"description": "The authentication mode string (INTERNAL, EXTERNAL, EXTERNAL_INSECURE, PKI).",
"description": "The authentication mode string (INTERNAL, EXTERNAL, PKI).",
"type": "string",
"enum": [
"INTERNAL",
"EXTERNAL",
"EXTERNAL_INSECURE",
"PKI"
]
},
Expand Down
4 changes: 2 additions & 2 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2217,8 +2217,8 @@
"description" : "Credentials represents authentication details to the Aerospike cluster.",
"properties" : {
"auth-mode" : {
"description" : "The authentication mode string (INTERNAL, EXTERNAL, EXTERNAL_INSECURE, PKI).",
"enum" : [ "INTERNAL", "EXTERNAL", "EXTERNAL_INSECURE", "PKI" ],
"description" : "The authentication mode string (INTERNAL, EXTERNAL, PKI).",
"enum" : [ "INTERNAL", "EXTERNAL", "PKI" ],
"type" : "string"
},
"password" : {
Expand Down
4 changes: 1 addition & 3 deletions docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1745,12 +1745,10 @@ components:
cluster.
properties:
auth-mode:
description: "The authentication mode string (INTERNAL, EXTERNAL, EXTERNAL_INSECURE,\
\ PKI)."
description: "The authentication mode string (INTERNAL, EXTERNAL, PKI)."
enum:
- INTERNAL
- EXTERNAL
- EXTERNAL_INSECURE
- PKI
type: string
password:
Expand Down
12 changes: 10 additions & 2 deletions pkg/dto/aerospike_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"io"
"strings"

"github.com/aerospike/aerospike-backup-service/v2/pkg/model"
)
Expand Down Expand Up @@ -176,8 +177,8 @@ type Credentials struct {
Password *string `yaml:"password,omitempty" json:"password,omitempty" example:"testPswd"`
// The file path with the password string.
PasswordPath *string `yaml:"password-path,omitempty" json:"password-path,omitempty" example:"/path/to/pass.txt"`
// The authentication mode string (INTERNAL, EXTERNAL, EXTERNAL_INSECURE, PKI).
AuthMode *string `yaml:"auth-mode,omitempty" json:"auth-mode,omitempty" enums:"INTERNAL,EXTERNAL,EXTERNAL_INSECURE,PKI"`
// The authentication mode string (INTERNAL, EXTERNAL, PKI).
AuthMode *string `yaml:"auth-mode,omitempty" json:"auth-mode,omitempty" enums:"INTERNAL,EXTERNAL,PKI"`
}

func (c *Credentials) fromModel(m *model.Credentials, config *model.Config) {
Expand Down Expand Up @@ -205,6 +206,13 @@ func (c *Credentials) Validate() error {
return fmt.Errorf("password and password-path are mutually exclusive")
}

if c.AuthMode != nil &&
!(strings.ToUpper(*c.AuthMode) == "INTERNAL" ||
strings.ToUpper(*c.AuthMode) == "EXTERNAL" ||
strings.ToUpper(*c.AuthMode) == "PKI") {
return fmt.Errorf("auth-mode %q incorrect, should be one of: INTERNAL,EXTERNAL,PKI", *c.AuthMode)
}

return c.SecretAgentConfig.validate()
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/model/aerospike_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ type Credentials struct {
Password *string
// The file path with the password string, will take precedence over the password field.
PasswordPath *string
// The authentication mode string (INTERNAL, EXTERNAL, EXTERNAL_INSECURE, PKI).
// The authentication mode string (INTERNAL, EXTERNAL, PKI).
AuthMode *string
// The name of the configured Secret Agent to use for authentication.
SecretAgent *SecretAgent
Expand Down
Loading