From eb1a2cd911f28b21375914420d5a464f45d4bd02 Mon Sep 17 00:00:00 2001 From: David Wu Date: Fri, 4 Jan 2019 11:02:57 -0800 Subject: [PATCH] default autoredirect to false Signed-off-by: David Wu --- registry/auth/token/accesscontroller.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/registry/auth/token/accesscontroller.go b/registry/auth/token/accesscontroller.go index 33d18a48..fa924f0b 100644 --- a/registry/auth/token/accesscontroller.go +++ b/registry/auth/token/accesscontroller.go @@ -162,11 +162,14 @@ func checkOptions(options map[string]interface{}) (tokenAccessOptions, error) { opts.realm, opts.issuer, opts.service, opts.rootCertBundle = vals[0], vals[1], vals[2], vals[3] - autoRedirect, ok := options["autoredirect"].(bool) - if !ok { - return opts, fmt.Errorf("token auth requires a valid option bool: autoredirect") + autoRedirectVal, ok := options["autoredirect"] + if ok { + autoRedirect, ok := autoRedirectVal.(bool) + if !ok { + return opts, fmt.Errorf("token auth requires a valid option bool: autoredirect") + } + opts.autoRedirect = autoRedirect } - opts.autoRedirect = autoRedirect return opts, nil }