From 479ee9af4905a89fdc8d33fc3108463edd9869f9 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Thu, 22 Nov 2018 16:52:03 +0100 Subject: [PATCH] Fix partial declaration of authentication. --- provider/label/partial.go | 2 ++ provider/label/partial_test.go | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/provider/label/partial.go b/provider/label/partial.go index d4b7652ad..feb8eaab7 100644 --- a/provider/label/partial.go +++ b/provider/label/partial.go @@ -109,6 +109,8 @@ func GetAuth(labels map[string]string) *types.Auth { auth.Digest = getAuthDigest(labels) } else if HasPrefix(labels, TraefikFrontendAuthForward) { auth.Forward = getAuthForward(labels) + } else { + return nil } return auth diff --git a/provider/label/partial_test.go b/provider/label/partial_test.go index 5ffa6415c..7dd218284 100644 --- a/provider/label/partial_test.go +++ b/provider/label/partial_test.go @@ -732,6 +732,13 @@ func TestGetAuth(t *testing.T) { labels: map[string]string{}, expected: nil, }, + { + desc: "should return nil when no real auth", + labels: map[string]string{ + TraefikFrontendAuthHeaderField: "myHeaderField", + }, + expected: nil, + }, { desc: "should return a basic auth", labels: map[string]string{