// AuthenticationErrorCode returns an error code for the given authentication error.
// If the error is not recognized, a generic error code is returned.
17889
func AuthenticationErrorCode(err error) string {
	switch {
	case identitymapper.IsClaimError(err):
		return errorCodeClaim
	case identitymapper.IsLookupError(err):
		return errorCodeLookup
	default:
		return errorCodeAuthentication
	}
}
465029
func (s *UserError) SetErrorCode(v string) *UserError {
	s.ErrorCode = &v
	return s
}
235669
func (s *FleetError) SetErrorCode(v string) *FleetError {
	s.ErrorCode = &v
	return s
}
700662
func (u *User) AuthCode() string {
	return u.Data().Get(common.UserKeyAuthCode).Str()
}
297930
func IsInvalidAuthTokenError(err error) bool {
	cause := errors.Cause(err)
	cferr, ok := cause.(CloudFoundryError)
	if !ok {
		return false
	}
	return cferr.Code == 1000
}
797628
func UnauthorizedError(ctx context.Context, w http.ResponseWriter) {
	EncodeError(ctx, &platform.Error{
		Code: platform.EUnauthorized,
		Msg:  "unauthorized access",
	}, w)
}
333900
func (s *EnableMFADeviceInput) SetAuthenticationCode2(v string) *EnableMFADeviceInput {
	s.AuthenticationCode2 = &v
	return s
}
560602
func (s *FailedScheduledUpdateGroupActionRequest) SetErrorCode(v string) *FailedScheduledUpdateGroupActionRequest {
	s.ErrorCode = &v
	return s
}
428152
func (s *Warning) SetErrorCode(v string) *Warning {
	s.ErrorCode = &v
	return s
}
1231213
func (s *UserStackAssociationError) SetErrorCode(v string) *UserStackAssociationError {
	s.ErrorCode = &v
	return s
}
947483
func (e JSONCliError) ExitCode() int {
	if e.resp == nil {
		return 1
	}
	code := e.resp.HTTP.StatusCode
	if code >= 100 && code < 200 {
		return 10
	} else if code >= 200 && code < 300 {
		return 20
	} else if code >= 300 && code < 400 {
		return 30
	} else if code >= 400 && code < 500 {
		return 40
	} else if code >= 500 && code < 600 {
		return 50
	}
	return 2
}
99613
func (r *ExchangeAuthorizationError) Error() string {
	return fmt.Sprintf("%v %v: %v %v",
		r.HttpResponse.Request.Method, r.HttpResponse.Request.URL,
		r.ErrorCode, r.ErrorDescription)
}
242932
func (h *NegotiationHandler) WriteErrorCode(w http.ResponseWriter, r *http.Request, code int, err interface{}) {
	switch httputil.NegotiateContentType(r, []string{}, "application/json") {
	case "text/html":
		h.html.WriteErrorCode(w, r, code, err)
		return
	case "text/plain":
		h.plain.WriteErrorCode(w, r, code, err)
		return
	case "application/json":
		h.json.WriteErrorCode(w, r, code, err)
		return
	default:
		h.json.WriteErrorCode(w, r, code, err)
		return
	}
}
313881
func (s *StackError) SetErrorCode(v string) *StackError {
	s.ErrorCode = &v
	return s
}
810461
func (e ServerErrorUnauthorized) Error() string {
	msg := "MDServer Unauthorized"
	if e.Err != nil {
		msg += ": " + e.Err.Error()
	}
	return msg
}
29823
func IsArangoErrorWithCode(err error, code int) bool {
	ae, ok := Cause(err).(ArangoError)
	return ok && ae.Code == code
}
420417
func HttpAuthenticator(handler func(*http.Request) (bool, interface{}, error)) runtime.Authenticator {
	return runtime.AuthenticatorFunc(func(params interface{}) (bool, interface{}, error) {
		if request, ok := params.(*http.Request); ok {
			return handler(request)
		}
		if scoped, ok := params.(*ScopedAuthRequest); ok {
			return handler(scoped.Request)
		}
		return false, nil, nil
	})
}