github.com/greenpau/go-authcrunch@v1.1.4/pkg/errors/common.go (about)

     1  // Copyright 2022 Paul Greenberg greenpau@outlook.com
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package errors
    16  
    17  // Generic Errors
    18  const (
    19  	ErrEmptyACLAction                     StandardError = "empty access list action"
    20  	ErrEmptyACLClaim                      StandardError = "empty access list claim"
    21  	ErrEmptyMethod                        StandardError = "empty http method"
    22  	ErrEmptyPath                          StandardError = "empty http path"
    23  	ErrEmptyClaim                         StandardError = "empty claim value"
    24  	ErrEmptyValue                         StandardError = "empty value"
    25  	ErrNoValues                           StandardError = "no acl.Values"
    26  	ErrUnsupportedACLAction               StandardError = "unsupported access list action: %s"
    27  	ErrUnsupportedClaim                   StandardError = "access list does not support %s claim, only audiences, roles, scopes"
    28  	ErrUnsupportedMethod                  StandardError = "unsupported http method: %s"
    29  	ErrKeyIDNotFound                      StandardError = "key ID not found"
    30  	ErrUnsupportedKeyType                 StandardError = "unsupported key type %T for key ID %s"
    31  	ErrRSAKeysNotFound                    StandardError = "no RSA keys found"
    32  	ErrECDSAKeysNotFound                  StandardError = "no ECDSA keys found"
    33  	ErrPrivateKeysNotFound                StandardError = "no private keys found"
    34  	ErrUnknownConfigSource                StandardError = "sig key config source is not found"
    35  	ErrReadPEMFile                        StandardError = "(source: %s): read PEM file: %v"
    36  	ErrWalkDir                            StandardError = "walking directory: %v"
    37  	ErrProvisonFailed                     StandardError = "authorization provider provisioning error"
    38  	ErrEmptyProviderName                  StandardError = "authorization provider name is empty"
    39  	ErrNoMemberReference                  StandardError = "no member reference found"
    40  	ErrTooManyPrimaryInstances            StandardError = "found more than one primaryInstance instance of the plugin for %s context"
    41  	ErrUndefinedSecret                    StandardError = "%s: token keys and secrets must be defined either via environment variables or via token_ configuration element"
    42  	ErrInvalidConfiguration               StandardError = "%s: configuration error: %v"
    43  	ErrTokenAlreadyConfigured             StandardError = "token already configured"
    44  	ErrLoadCryptoKeyConfig                StandardError = "%s: failed loading token in %s context: %v"
    45  	ErrUnsupportedSignatureMethod         StandardError = "%s: unsupported token sign/verify method: %s"
    46  	ErrUnsupportedTokenSource             StandardError = "%s: unsupported token source: %s"
    47  	ErrInvalidBackendConfiguration        StandardError = "%s: token validator configuration error: %s"
    48  	ErrUnknownProvider                    StandardError = "authorization provider %s not found"
    49  	ErrInvalidProvider                    StandardError = "authorization provider %s is nil"
    50  	ErrNoPrimaryInstanceProvider          StandardError = "no primaryInstance authorization provider found in %s context when configuring %s"
    51  	ErrNoCryptoKeysFound                  StandardError = "no crypto keys found in %s context"
    52  	ErrLoadingKeys                        StandardError = "loading %s keys: %v"
    53  	ErrInvalidClaimExpiresAt              StandardError = "invalid exp type: %T"
    54  	ErrInvalidClaimIssuedAt               StandardError = "invalid iat type: %T"
    55  	ErrInvalidClaimNotBefore              StandardError = "invalid nbf type: %T"
    56  	ErrInvalidSigningMethod               StandardError = "unsupported signing method"
    57  	ErrEmptySecret                        StandardError = "empty secrets are not supported"
    58  	ErrInvalidAudience                    StandardError = "invalid audience type %T in audience"
    59  	ErrInvalidAudienceType                StandardError = "invalid audience type %T"
    60  	ErrInvalidRole                        StandardError = "invalid role type %T in roles"
    61  	ErrInvalidRoleType                    StandardError = "invalid roles type %T"
    62  	ErrInvalidScope                       StandardError = "invalid scope type %T in scopes"
    63  	ErrInvalidScopeType                   StandardError = "invalid scopes type %T"
    64  	ErrInvalidOrg                         StandardError = "invalid org type %T in orgs"
    65  	ErrInvalidOrgType                     StandardError = "invalid orgs type %T"
    66  	ErrInvalidAppMetadataRoleType         StandardError = "invalid roles type %T in app_metadata-authorization"
    67  	ErrInvalidAddrType                    StandardError = "invalid ip address type %T in addr"
    68  	ErrInvalidAccessListPath              StandardError = "invalid acl path type %T in paths"
    69  	ErrInvalidIDClaimType                 StandardError = "invalid jti claim value type %T"
    70  	ErrInvalidIssuerClaimType             StandardError = "invalid iss claim value type %T"
    71  	ErrInvalidSubjectClaimType            StandardError = "invalid sub claim value type %T"
    72  	ErrInvalidEmailClaimType              StandardError = "invalid %s claim value type %T"
    73  	ErrInvalidNameClaimType               StandardError = "invalid name claim value type %T"
    74  	ErrInvalidOriginClaimType             StandardError = "invalid origin claim value type %T"
    75  	ErrInvalidPictureClaimType            StandardError = "invalid picture claim value type %T"
    76  	ErrInvalidMetadataClaimType           StandardError = "invalid metadata claim value type %T"
    77  	ErrSigningOptionsNotFound             StandardError = "signing options not found"
    78  	ErrSigningMethodNotFound              StandardError = "signing method not found"
    79  	ErrSharedSigningKeyNotFound           StandardError = "shared secret for signing not found"
    80  	ErrPrivateSigningKeyNotFound          StandardError = "private key for signing not found"
    81  	ErrNoBackends                         StandardError = "no token backends available"
    82  	ErrExpiredToken                       StandardError = "expired token"
    83  	ErrNoAccessList                       StandardError = "user role is valid, but denied by default deny on empty access list"
    84  	ErrAccessNotAllowed                   StandardError = "user role is valid, but not allowed by access list"
    85  	ErrAccessNotAllowedByPathACL          StandardError = "user role is valid, but not allowed by path access list"
    86  	ErrSourceAddressNotFound              StandardError = "source ip validation is enabled, but no ip address claim found"
    87  	ErrSourceAddressMismatch              StandardError = "source ip address mismatch between the claim %q and request %q"
    88  	ErrNoParsedClaims                     StandardError = "failed to extract claims"
    89  	ErrNoTokenFound                       StandardError = "no token found"
    90  	ErrInvalidParsedClaims                StandardError = "failed to extract claims: %s"
    91  	ErrInvalidSecret                      StandardError = "secret key backend error: %s"
    92  	ErrInvalid                            StandardError = "%v"
    93  	ErrMixedAlgorithms                    StandardError = "mixed key algorithms found in %s: %v"
    94  	ErrFoundDuplicateKeyID                StandardError = "duplicate kid %s for %s keys found in %s"
    95  	ErrMixedConfigKeyType                 StandardError = "failed adding key to %s config, key type %s"
    96  	ErrUnsupportedConfigKeyType           StandardError = "unsupported key type in token config: %T"
    97  	ErrNotECDSAPrivatePEMEncodedKey       StandardError = "the key is not ECDSA private PEM-encoded key: %s"
    98  	ErrNotPEMEncodedKey                   StandardError = "the key is not PEM-encoded key"
    99  	ErrNotECDSAPrivateKey                 StandardError = "the key is not ECDSA private key"
   100  	ErrNotECDSAPublicKey                  StandardError = "the key is not ECDSA public key"
   101  	ErrNotECDSAPublicKeyType              StandardError = "the key is not ECDSA public key: %T"
   102  	ErrEmptyCryptoKeyConfigOrigin         StandardError = "empty token config origin"
   103  	ErrUnsupportedCryptoKeyConfigOrigin   StandardError = "unsupported token config origin: %s"
   104  	ErrPrimaryRegistrationFailed          StandardError = "primary instance registration for %s context failed"
   105  	ErrRegistrationTimeout                StandardError = "non-primary instance registration in %s context timed out"
   106  	ErrAuthorizerFailed                   StandardError = "authorizer %s in %s context failed"
   107  	ErrContextNotFound                    StandardError = "authorizer %s in %s context not found"
   108  	ErrContextFailed                      StandardError = "authorizer %s in failed %s context"
   109  	ErrPrimaryInstanceNotFound            StandardError = "authorizer %s has not primary instance in %s context"
   110  	ErrPrimaryInstanceNotInitialized      StandardError = "authorizer %s has uninitialized primary instance in %s context"
   111  	ErrPrimaryInstanceFailed              StandardError = "authorizer %s has failed primary instance in %s context"
   112  	ErrInstanceValidatationTimeout        StandardError = "authorizer %s in %s context failed to due to timeout"
   113  	ErrMultipleSigningKeys                StandardError = "multiple signing keys found"
   114  	ErrSigningKeyNotFound                 StandardError = "signing key not found for %v"
   115  	ErrSigningKeyNil                      StandardError = "signing key is nil"
   116  	ErrSigningKeyTooShort                 StandardError = "signing key is too short"
   117  	ErrDataSigningFailed                  StandardError = "data signing failed for %v: %v"
   118  	ErrGetSignedTokenEmpty                StandardError = "token signing failed for %v: empty signed token"
   119  	ErrSigningKeyMethodPrivateKeyConflict StandardError = "token signing failed: method and private key conflict %s vs. %s"
   120  	ErrParsePrivateRSAKey                 StandardError = "failed to parse private RSA key: %v"
   121  	ErrParsePrivateECDSAKey               StandardError = "failed to parse private ECDSA key: %v"
   122  	ErrParsePublicRSAKey                  StandardError = "failed to parse public RSA key: %v"
   123  	ErrParsePublicECDSAKey                StandardError = "failed to parse public ECDSA key: %v"
   124  	ErrECDSAPrivateKeyCurveNotSupported   StandardError = "the private ECDSA key has unsupported curve: %s"
   125  	ErrUnsupportedECDSACurve              StandardError = "found unsupported ECDSA curve: %s"
   126  	ErrEmptyECDSACurve                    StandardError = "found empty ECDSA curve"
   127  	ErrNoECDSACurveParamsFound            StandardError = "no ECDSA curve parameters found"
   128  	ErrParseEnvVar                        StandardError = "failed to parse environment variable %s: %v"
   129  	ErrEncryptionKeysNotFound             StandardError = "encryption keys not found"
   130  	ErrKeyOverwriteFailed                 StandardError = "failed to overwrite used key id %s"
   131  	ErrKeyNil                             StandardError = "key is nil"
   132  	ErrCryptoKeyConfigNil                 StandardError = "token configuration is nil"
   133  	ErrFailed                             StandardError = "encountered error: %v"
   134  
   135  	// InstanceManager errors.
   136  	ErrInstanceManagerValidate StandardError = "instance %q validation failed: %v"
   137  	ErrInvalidLoginHint        StandardError = "login_hint query parameter is not in a valid format"
   138  	ErrInvalidAdditionalScopes StandardError = "additional_scopes query parameter is not in a valid format"
   139  )