This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodel_auth_error_code.go
139 lines (121 loc) · 5.33 KB
/
model_auth_error_code.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/**
* Go SDK for Auth0 Fine Grained Authorization (FGA)
*
* API version: 0.1
* Website: <https://fga.dev>
* Documentation: <https://docs.fga.dev>
* Support: <https://discord.gg/8naAwJfWN6>
* License: [MIT](https://github.com/auth0-lab/fga-go-sdk/blob/main/LICENSE)
*
* NOTE: This file was auto generated by [OpenAPI Generator](https://openapi-generator.tech). DO NOT EDIT.
*/
package auth0fga
import (
"encoding/json"
"fmt"
)
// AuthErrorCode - no_auth_error: no error - auth_failure: generic authentication error. Details available via message field. - auth_failed_invalid_subject: authentication failure due to invalid subject. - auth_failed_invalid_audience: authentication failure due to invalid audience. - auth_failed_invalid_issuer: authentication failure due to invalid issuer. - invalid_claims: authentication failure due to invalid claims. - auth_failed_invalid_bearer_token: authentication failure due to invalid bearer token. - missing_customer_in_bearer_token: authentication failure with customer id missing in bearer token. - missing_store_in_bearer_token: authentication failure with store id missing in bearer token. - store_mismatch_in_bearer_token: authentication failure due to store mismatch from bearer token. - customer_mismatch_in_bearer_token: authentication failure due to customer id in the request being different from the customer id in the bearer token. - bearer_token_missing: bearer token missing in request. - missing_user_in_bearer_token: authentication failure with user id missing in bearer token. - unauthenticated: unauthenticated. - insufficient_permissions: insufficient permissions. - unauthorized_principal: authentication denial due to unauthorized principal.
type AuthErrorCode string
// List of AuthErrorCode
const (
NO_AUTH_ERROR AuthErrorCode = "no_auth_error"
AUTH_FAILURE AuthErrorCode = "auth_failure"
AUTH_FAILED_INVALID_SUBJECT AuthErrorCode = "auth_failed_invalid_subject"
AUTH_FAILED_INVALID_AUDIENCE AuthErrorCode = "auth_failed_invalid_audience"
AUTH_FAILED_INVALID_ISSUER AuthErrorCode = "auth_failed_invalid_issuer"
INVALID_CLAIMS AuthErrorCode = "invalid_claims"
AUTH_FAILED_INVALID_BEARER_TOKEN AuthErrorCode = "auth_failed_invalid_bearer_token"
MISSING_CUSTOMER_IN_BEARER_TOKEN AuthErrorCode = "missing_customer_in_bearer_token"
MISSING_STORE_IN_BEARER_TOKEN AuthErrorCode = "missing_store_in_bearer_token"
STORE_MISMATCH_IN_BEARER_TOKEN AuthErrorCode = "store_mismatch_in_bearer_token"
CUSTOMER_MISMATCH_IN_BEARER_TOKEN AuthErrorCode = "customer_mismatch_in_bearer_token"
BEARER_TOKEN_MISSING AuthErrorCode = "bearer_token_missing"
MISSING_USER_IN_BEARER_TOKEN AuthErrorCode = "missing_user_in_bearer_token"
UNAUTHENTICATED AuthErrorCode = "unauthenticated"
INSUFFICIENT_PERMISSIONS AuthErrorCode = "insufficient_permissions"
UNAUTHORIZED_PRINCIPAL AuthErrorCode = "unauthorized_principal"
)
var allowedAuthErrorCodeEnumValues = []AuthErrorCode{
"no_auth_error",
"auth_failure",
"auth_failed_invalid_subject",
"auth_failed_invalid_audience",
"auth_failed_invalid_issuer",
"invalid_claims",
"auth_failed_invalid_bearer_token",
"missing_customer_in_bearer_token",
"missing_store_in_bearer_token",
"store_mismatch_in_bearer_token",
"customer_mismatch_in_bearer_token",
"bearer_token_missing",
"missing_user_in_bearer_token",
"unauthenticated",
"insufficient_permissions",
"unauthorized_principal",
}
func (v *AuthErrorCode) UnmarshalJSON(src []byte) error {
var value string
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
enumTypeValue := AuthErrorCode(value)
for _, existing := range allowedAuthErrorCodeEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid AuthErrorCode", value)
}
// NewAuthErrorCodeFromValue returns a pointer to a valid AuthErrorCode
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewAuthErrorCodeFromValue(v string) (*AuthErrorCode, error) {
ev := AuthErrorCode(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for AuthErrorCode: valid values are %v", v, allowedAuthErrorCodeEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v AuthErrorCode) IsValid() bool {
for _, existing := range allowedAuthErrorCodeEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to AuthErrorCode value
func (v AuthErrorCode) Ptr() *AuthErrorCode {
return &v
}
type NullableAuthErrorCode struct {
value *AuthErrorCode
isSet bool
}
func (v NullableAuthErrorCode) Get() *AuthErrorCode {
return v.value
}
func (v *NullableAuthErrorCode) Set(val *AuthErrorCode) {
v.value = val
v.isSet = true
}
func (v NullableAuthErrorCode) IsSet() bool {
return v.isSet
}
func (v *NullableAuthErrorCode) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAuthErrorCode(val *AuthErrorCode) *NullableAuthErrorCode {
return &NullableAuthErrorCode{value: val, isSet: true}
}
func (v NullableAuthErrorCode) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAuthErrorCode) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}