caerrors

package
v0.0.0-...-a0081c5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Unknown error code
	ErrUnknown = 0
	// HTTP method not allowed
	ErrMethodNotAllowed = 1
	// No authorization header was found in request
	ErrNoAuthHdr = 2
	// Failed reading the HTTP request body
	ErrReadingReqBody = 3
	// HTTP request body was empty but should not have been
	ErrEmptyReqBody = 4
	// HTTP request body was of the wrong format
	ErrBadReqBody = 5
	// The token in the authorization header was invalid
	ErrBadReqToken = 6
	// The caller does not have the "hf.Revoker" attibute
	ErrNotRevoker = 7
	// Certificate to be revoked was not found
	ErrRevCertNotFound = 8
	// Certificate to be revoked is not owned by expected user
	ErrCertWrongOwner = 9
	// Identity of certificate to be revoked was not found
	ErrRevokeIDNotFound = 10
	// User info was not found for issuee of revoked certificate
	ErrRevokeUserInfoNotFound = 11
	// Certificate revocation failed for another reason
	ErrRevokeFailure = 12
	// Failed to update user info when revoking identity
	ErrRevokeUpdateUser = 13
	// Failed to revoke any certificates by identity
	ErrNoCertsRevoked = 14
	// Missing fields in the revocation request
	ErrMissingRevokeArgs = 15
	// Failed to get user's affiliation
	ErrGettingAffiliation = 16
	// Revoker's affiliation not equal to or above revokee's affiliation
	ErrRevokerNotAffiliated = 17
	// Failed to send an HTTP response
	ErrSendingResponse = 18
	// The CA (Certificate Authority) name was not found
	ErrCANotFound = 19
	// Authorization failure
	ErrAuthenticationFailure = 20
	// No username and password were in the authorization header
	ErrNoUserPass = 21
	// Enrollment is currently disabled for the server
	ErrEnrollDisabled = 22
	// Invalid user name
	ErrInvalidUser = 23
	// Invalid password
	ErrInvalidPass = 24
	// Invalid token in authorization header
	ErrInvalidToken = 25
	// Certificate was not issued by a trusted authority
	ErrUntrustedCertificate = 26
	// Certificate has expired
	ErrCertExpired = 27
	// Certificate has been revoked
	ErrCertRevoked = 28
	// Failed trying to check if certificate is revoked
	ErrCertRevokeCheckFailure = 29
	// Certificate was not found
	ErrCertNotFound = 30
	// Bad certificate signing request
	ErrBadCSR = 31
	// Failed to get identity's prekey
	ErrNoPreKey = 32
	// The caller was not authenticated
	ErrCallerIsNotAuthenticated = 33
	// Invalid configuration setting
	ErrConfig = 34
	// The caller does not have authority to generate a CRL
	ErrNoGenCRLAuth = 35
	// Invalid RevokedAfter value in the GenCRL request
	ErrInvalidRevokedAfter = 36
	// Invalid ExpiredAfter value in the GenCRL request
	ErrInvalidExpiredAfter = 37
	// Failed to get revoked certs from the database
	ErrRevokedCertsFromDB = 38
	// Failed to get CA cert
	ErrGetCACert = 39
	// Failed to get CA signer
	ErrGetCASigner = 40
	// Failed to generate CRL
	ErrGenCRL = 41
	// Registrar does not have the authority to register an attribute
	ErrRegAttrAuth = 42
	// Registrar does not own 'hf.Registrar.Attributes'
	ErrMissingRegAttr = 43
	// Caller does not have appropriate affiliation to perform requested action
	ErrCallerNotAffiliated = 44
	// Failed to verify if caller has appropriate type
	ErrGettingType = 45
	// CA cert does not have 'crl sign' usage
	ErrNoCrlSignAuth = 46
	// Incorrect level of database
	ErrDBLevel = 47
	// Incorrect level of configuration file
	ErrConfigFileLevel = 48
	// Failed to get user from database
	ErrGettingUser = 49
	// Error processing HTTP request
	ErrHTTPRequest = 50
	// Error connecting to database
	ErrConnectingDB = 51
	// Failed to add identity
	ErrAddIdentity = 52
	// Unauthorized to perform update action
	ErrUpdateConfigAuth = 53
	// Registrar not authorized to act on type
	ErrRegistrarInvalidType = 54
	// Registrar not authorized to act on affiliation
	ErrRegistrarNotAffiliated = 55
	// Failed to remove identity
	ErrRemoveIdentity = 56
	// Failed to get boolean query parameter
	ErrGettingBoolQueryParm = 57
	// Failed to modify identity
	ErrModifyingIdentity = 58
	// Caller does not have the appropriate role
	ErrMissingRole = 59
	// Failed to add new affiliation
	ErrUpdateConfigAddAff = 60
	// Failed to remove affiliation
	ErrUpdateConfigRemoveAff = 61
	// Error occured while removing affiliation in database
	ErrRemoveAffDB = 62
	// Error occured when making a Get request to database
	ErrDBGet = 63
	// Failed to modiy affiliation
	ErrUpdateConfigModifyAff = 64
	// Error occured while deleting user
	ErrDBDeleteUser = 65
	// Certificate that is being revoked has already been revoked
	ErrCertAlreadyRevoked = 66
	// Failed to get requested certificate(s)
	ErrGettingCert = 67
	// Error occurred parsing variable as an integer
	ErrParsingIntEnvVar = 68
	// CA certificate file is not found warning message
	ErrCACertFileNotFound = 69
	// Error occurs when invoking a request revoked enrollment ID
	ErrRevokedID = 70
	// Authorization failure
	ErrAuthorizationFailure = 71
	// Action is not allowed when using LDAP
	ErrInvalidLDAPAction = 72
	// Incorrect password limit reached
	ErrPasswordAttempts = 73
)

Error codes

Variables

This section is empty.

Functions

func IsFatalError

func IsFatalError(err error) bool

IsFatalError return true if the error is of type 'FatalErr'

func NewAuthenticationErr

func NewAuthenticationErr(code int, format string, args ...interface{}) error

NewAuthenticationErr constructs an HTTP error specifically indicating an authentication failure. The local code and message is specific, but the remote code and message is generic for security reasons.

func NewAuthorizationErr

func NewAuthorizationErr(code int, format string, args ...interface{}) error

NewAuthorizationErr constructs an HTTP error specifically indicating an authorization failure. The local code and message is specific, but the remote code and message is generic for security reasons.

func NewHTTPErr

func NewHTTPErr(scode, code int, format string, args ...interface{}) error

NewHTTPErr constructs a new HTTP error wrappered with pkg/errors error.

Types

type FatalErr

type FatalErr struct {
	ServerErr
}

FatalErr is a server error that is will prevent the server/CA from continuing to operate

func NewFatalError

func NewFatalError(code int, format string, args ...interface{}) *FatalErr

NewFatalError constructs a fatal error

func (*FatalErr) Error

func (fe *FatalErr) Error() string

func (*FatalErr) String

func (fe *FatalErr) String() string

type HTTPErr

type HTTPErr struct {
	// contains filtered or unexported fields
}

HTTPErr is an HTTP error. "local" refers to errors as logged in the server (local to the server). "remote" refers to errors as returned to the client (remote to the server). This allows us to log a more specific error in the server logs while returning a more generic error to the client, as is done for authorization failures.

func CreateHTTPErr

func CreateHTTPErr(scode, code int, format string, args ...interface{}) *HTTPErr

CreateHTTPErr constructs a new HTTP error.

func (*HTTPErr) Error

func (he *HTTPErr) Error() string

Error returns the string representation

func (*HTTPErr) GetLocalCode

func (he *HTTPErr) GetLocalCode() int

GetLocalCode returns the local error code

func (*HTTPErr) GetLocalMsg

func (he *HTTPErr) GetLocalMsg() string

GetLocalMsg returns the remote error message

func (*HTTPErr) GetRemoteCode

func (he *HTTPErr) GetRemoteCode() int

GetRemoteCode returns the remote error code

func (*HTTPErr) GetRemoteMsg

func (he *HTTPErr) GetRemoteMsg() string

GetRemoteMsg returns the remote error message

func (*HTTPErr) GetStatusCode

func (he *HTTPErr) GetStatusCode() int

GetStatusCode returns the HTTP status code

func (*HTTPErr) Remote

func (he *HTTPErr) Remote(code int, format string, args ...interface{}) *HTTPErr

Remote sets the remote code and message to something different from that of the local code and message

func (*HTTPErr) String

func (he *HTTPErr) String() string

String returns a string representation of this augmented error

type ServerErr

type ServerErr struct {
	// contains filtered or unexported fields
}

ServerErr contains error message with corresponding CA error code

func NewServerError

func NewServerError(code int, format string, args ...interface{}) *ServerErr

NewServerError constructs a server error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL