code: func (auth *AuthProxy) GetUserIDViaHeader() (int64, error) {
  	extUser := &models.ExternalUserInfo{
  		AuthModule: "authproxy",
  		AuthId:     auth.header,
  	}
  
  	if auth.headerType == "username" {
  		extUser.Login = auth.header
  
  		// only set Email if it can be parsed as an email address
  		emailAddr, emailErr := mail.ParseAddress(auth.header)
  		if emailErr == nil {
  			extUser.Email = emailAddr.Address
  		}
  	} else if auth.headerType == "email" {
  		extUser.Email = auth.header
  		extUser.Login = auth.header
  	} else {
  		return 0, newError("Auth proxy header property invalid", nil)
  	}
  
  	for _, field := range []string{"Name", "Email", "Login"} {
  		if auth.headers[field] == "" {
  			continue
  		}
  
  		if val := auth.ctx.Req.Header.Get(auth.headers[field]); val != "" {
  			reflect.ValueOf(extUser).Elem().FieldByName(field).SetString(val)
  		}
  	}
  
  	// add/update user in grafana
  	cmd := &models.UpsertUserCommand{
  		ReqContext:    auth.ctx,
  		ExternalUser:  extUser,
  		SignupAllowed: setting.AuthProxyAutoSignUp,
  	}
  	err := bus.Dispatch(cmd)
  	if err != nil {
  		return 0, err
  	}
  
  	return cmd.Result.Id, nil
  }
docs: // GetUserIDViaHeader gets user from the header only