Fix: deny the blocked user request

This commit is contained in:
hongming
2022-05-11 14:37:41 +08:00
parent ac423922cf
commit f304ecdd01
2 changed files with 10 additions and 3 deletions

View File

@@ -437,6 +437,9 @@ func (h *handler) passwordGrant(username string, password string, req *restful.R
authenticated, provider, err := h.passwordAuthenticator.Authenticate(req.Request.Context(), username, password)
if err != nil {
switch err {
case auth.AccountIsNotActiveError:
response.WriteHeaderAndEntity(http.StatusBadRequest, oauth.NewInvalidGrant(err))
return
case auth.IncorrectPasswordError:
requestInfo, _ := request.RequestInfoFrom(req.Request.Context())
if err := h.loginRecorder.RecordLogin(username, iamv1alpha2.Token, provider, requestInfo.SourceIP, requestInfo.UserAgent, err); err != nil {