Documentation ¶
Index ¶
- Constants
- func IsFatalError(err error) bool
- func NewAuthenticationErr(code int, format string, args ...interface{}) error
- func NewAuthorizationErr(code int, format string, args ...interface{}) error
- func NewHTTPErr(scode, code int, format string, args ...interface{}) error
- type FatalErr
- type HTTPErr
- func (he *HTTPErr) Error() string
- func (he *HTTPErr) GetLocalCode() int
- func (he *HTTPErr) GetLocalMsg() string
- func (he *HTTPErr) GetRemoteCode() int
- func (he *HTTPErr) GetRemoteMsg() string
- func (he *HTTPErr) GetStatusCode() int
- func (he *HTTPErr) Remote(code int, format string, args ...interface{}) *HTTPErr
- func (he *HTTPErr) String() string
- type ServerErr
Constants ¶
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 ¶
IsFatalError return true if the error is of type 'FatalErr'
func NewAuthenticationErr ¶
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 ¶
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 ¶
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 ¶
NewFatalError constructs a fatal error
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 ¶
CreateHTTPErr constructs a new HTTP error.
func (*HTTPErr) GetLocalCode ¶
GetLocalCode returns the local error code
func (*HTTPErr) GetLocalMsg ¶
GetLocalMsg returns the remote error message
func (*HTTPErr) GetRemoteCode ¶
GetRemoteCode returns the remote error code
func (*HTTPErr) GetRemoteMsg ¶
GetRemoteMsg returns the remote error message
func (*HTTPErr) GetStatusCode ¶
GetStatusCode returns the HTTP status code