diff --git a/docs/examples/auth/basic/README.md b/docs/examples/auth/basic/README.md index a786df2b4..0a21911cf 100644 --- a/docs/examples/auth/basic/README.md +++ b/docs/examples/auth/basic/README.md @@ -10,6 +10,11 @@ Re-type new password: Adding password for user foo ``` +To create your file without `htpasswd` +```console +$ printf "foo:$(openssl passwd -crypt )\n" >> auth +``` + ```console $ kubectl create secret generic basic-auth --from-file=auth secret "basic-auth" created @@ -19,7 +24,7 @@ secret "basic-auth" created $ kubectl get secret basic-auth -o yaml apiVersion: v1 data: - auth: Zm9vOiRhcHIxJE9GRzNYeWJwJGNrTDBGSERBa29YWUlsSDkuY3lzVDAK + kube-ingress-auth: Zm9vOiRhcHIxJE9GRzNYeWJwJGNrTDBGSERBa29YWUlsSDkuY3lzVDAK kind: Secret metadata: name: basic-auth diff --git a/pkg/ingress/annotations/auth/main.go b/pkg/ingress/annotations/auth/main.go index 5830f0f71..808303b26 100644 --- a/pkg/ingress/annotations/auth/main.go +++ b/pkg/ingress/annotations/auth/main.go @@ -152,7 +152,7 @@ func (a auth) Parse(ing *extensions.Ingress) (interface{}, error) { // dumpSecret dumps the content of a secret into a file // in the expected format for the specified authorization func dumpSecret(filename string, secret *api.Secret) error { - val, ok := secret.Data["auth"] + val, ok := secret.Data["kube-ingress-auth"] if !ok { return ing_errors.LocationDenied{ Reason: errors.Errorf("the secret %v does not contain a key with value auth", secret.Name), diff --git a/pkg/ingress/annotations/auth/main_test.go b/pkg/ingress/annotations/auth/main_test.go index df042ad4f..e30d74d3c 100644 --- a/pkg/ingress/annotations/auth/main_test.go +++ b/pkg/ingress/annotations/auth/main_test.go @@ -79,7 +79,7 @@ func (m mockSecret) GetSecret(name string) (*api.Secret, error) { Namespace: api.NamespaceDefault, Name: "demo-secret", }, - Data: map[string][]byte{"auth": []byte("foo:$apr1$OFG3Xybp$ckL0FHDAkoXYIlH9.cysT0")}, + Data: map[string][]byte{"kube-ingress-auth": []byte("foo:$apr1$OFG3Xybp$ckL0FHDAkoXYIlH9.cysT0")}, }, nil }