From 964b60da29d1ac90ec045d14f6061d801242d257 Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Tue, 21 Sep 2021 22:57:37 +0800 Subject: [PATCH] Support silent login from HTTP basic authentication. --- routers/base.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/routers/base.go b/routers/base.go index ec84ef1b..4054278d 100644 --- a/routers/base.go +++ b/routers/base.go @@ -49,8 +49,12 @@ func denyRequest(ctx *context.Context) { } func getUsernameByClientIdSecret(ctx *context.Context) string { - clientId := ctx.Input.Query("clientId") - clientSecret := ctx.Input.Query("clientSecret") + clientId, clientSecret, ok := ctx.Request.BasicAuth() + if !ok { + clientId = ctx.Input.Query("clientId") + clientSecret = ctx.Input.Query("clientSecret") + } + if clientId == "" || clientSecret == "" { return "" }