-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
model_json_web_key.go
742 lines (625 loc) · 17.8 KB
/
model_json_web_key.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
/*
Ory Hydra API
Documentation for all of Ory Hydra's APIs.
API version: v2.2.1
Contact: [email protected]
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package client
import (
"encoding/json"
"fmt"
)
// checks if the JsonWebKey type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &JsonWebKey{}
// JsonWebKey struct for JsonWebKey
type JsonWebKey struct {
// The \"alg\" (algorithm) parameter identifies the algorithm intended for use with the key. The values used should either be registered in the IANA \"JSON Web Signature and Encryption Algorithms\" registry established by [JWA] or be a value that contains a Collision- Resistant Name.
Alg string `json:"alg"`
Crv *string `json:"crv,omitempty"`
D *string `json:"d,omitempty"`
Dp *string `json:"dp,omitempty"`
Dq *string `json:"dq,omitempty"`
E *string `json:"e,omitempty"`
K *string `json:"k,omitempty"`
// The \"kid\" (key ID) parameter is used to match a specific key. This is used, for instance, to choose among a set of keys within a JWK Set during key rollover. The structure of the \"kid\" value is unspecified. When \"kid\" values are used within a JWK Set, different keys within the JWK Set SHOULD use distinct \"kid\" values. (One example in which different keys might use the same \"kid\" value is if they have different \"kty\" (key type) values but are considered to be equivalent alternatives by the application using them.) The \"kid\" value is a case-sensitive string.
Kid string `json:"kid"`
// The \"kty\" (key type) parameter identifies the cryptographic algorithm family used with the key, such as \"RSA\" or \"EC\". \"kty\" values should either be registered in the IANA \"JSON Web Key Types\" registry established by [JWA] or be a value that contains a Collision- Resistant Name. The \"kty\" value is a case-sensitive string.
Kty string `json:"kty"`
N *string `json:"n,omitempty"`
P *string `json:"p,omitempty"`
Q *string `json:"q,omitempty"`
Qi *string `json:"qi,omitempty"`
// Use (\"public key use\") identifies the intended use of the public key. The \"use\" parameter is employed to indicate whether a public key is used for encrypting data or verifying the signature on data. Values are commonly \"sig\" (signature) or \"enc\" (encryption).
Use string `json:"use"`
X *string `json:"x,omitempty"`
// The \"x5c\" (X.509 certificate chain) parameter contains a chain of one or more PKIX certificates [RFC5280]. The certificate chain is represented as a JSON array of certificate value strings. Each string in the array is a base64-encoded (Section 4 of [RFC4648] -- not base64url-encoded) DER [ITU.X690.1994] PKIX certificate value. The PKIX certificate containing the key value MUST be the first certificate.
X5c []string `json:"x5c,omitempty"`
Y *string `json:"y,omitempty"`
AdditionalProperties map[string]interface{}
}
type _JsonWebKey JsonWebKey
// NewJsonWebKey instantiates a new JsonWebKey object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewJsonWebKey(alg string, kid string, kty string, use string) *JsonWebKey {
this := JsonWebKey{}
this.Alg = alg
this.Kid = kid
this.Kty = kty
this.Use = use
return &this
}
// NewJsonWebKeyWithDefaults instantiates a new JsonWebKey object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewJsonWebKeyWithDefaults() *JsonWebKey {
this := JsonWebKey{}
return &this
}
// GetAlg returns the Alg field value
func (o *JsonWebKey) GetAlg() string {
if o == nil {
var ret string
return ret
}
return o.Alg
}
// GetAlgOk returns a tuple with the Alg field value
// and a boolean to check if the value has been set.
func (o *JsonWebKey) GetAlgOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Alg, true
}
// SetAlg sets field value
func (o *JsonWebKey) SetAlg(v string) {
o.Alg = v
}
// GetCrv returns the Crv field value if set, zero value otherwise.
func (o *JsonWebKey) GetCrv() string {
if o == nil || IsNil(o.Crv) {
var ret string
return ret
}
return *o.Crv
}
// GetCrvOk returns a tuple with the Crv field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *JsonWebKey) GetCrvOk() (*string, bool) {
if o == nil || IsNil(o.Crv) {
return nil, false
}
return o.Crv, true
}
// HasCrv returns a boolean if a field has been set.
func (o *JsonWebKey) HasCrv() bool {
if o != nil && !IsNil(o.Crv) {
return true
}
return false
}
// SetCrv gets a reference to the given string and assigns it to the Crv field.
func (o *JsonWebKey) SetCrv(v string) {
o.Crv = &v
}
// GetD returns the D field value if set, zero value otherwise.
func (o *JsonWebKey) GetD() string {
if o == nil || IsNil(o.D) {
var ret string
return ret
}
return *o.D
}
// GetDOk returns a tuple with the D field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *JsonWebKey) GetDOk() (*string, bool) {
if o == nil || IsNil(o.D) {
return nil, false
}
return o.D, true
}
// HasD returns a boolean if a field has been set.
func (o *JsonWebKey) HasD() bool {
if o != nil && !IsNil(o.D) {
return true
}
return false
}
// SetD gets a reference to the given string and assigns it to the D field.
func (o *JsonWebKey) SetD(v string) {
o.D = &v
}
// GetDp returns the Dp field value if set, zero value otherwise.
func (o *JsonWebKey) GetDp() string {
if o == nil || IsNil(o.Dp) {
var ret string
return ret
}
return *o.Dp
}
// GetDpOk returns a tuple with the Dp field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *JsonWebKey) GetDpOk() (*string, bool) {
if o == nil || IsNil(o.Dp) {
return nil, false
}
return o.Dp, true
}
// HasDp returns a boolean if a field has been set.
func (o *JsonWebKey) HasDp() bool {
if o != nil && !IsNil(o.Dp) {
return true
}
return false
}
// SetDp gets a reference to the given string and assigns it to the Dp field.
func (o *JsonWebKey) SetDp(v string) {
o.Dp = &v
}
// GetDq returns the Dq field value if set, zero value otherwise.
func (o *JsonWebKey) GetDq() string {
if o == nil || IsNil(o.Dq) {
var ret string
return ret
}
return *o.Dq
}
// GetDqOk returns a tuple with the Dq field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *JsonWebKey) GetDqOk() (*string, bool) {
if o == nil || IsNil(o.Dq) {
return nil, false
}
return o.Dq, true
}
// HasDq returns a boolean if a field has been set.
func (o *JsonWebKey) HasDq() bool {
if o != nil && !IsNil(o.Dq) {
return true
}
return false
}
// SetDq gets a reference to the given string and assigns it to the Dq field.
func (o *JsonWebKey) SetDq(v string) {
o.Dq = &v
}
// GetE returns the E field value if set, zero value otherwise.
func (o *JsonWebKey) GetE() string {
if o == nil || IsNil(o.E) {
var ret string
return ret
}
return *o.E
}
// GetEOk returns a tuple with the E field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *JsonWebKey) GetEOk() (*string, bool) {
if o == nil || IsNil(o.E) {
return nil, false
}
return o.E, true
}
// HasE returns a boolean if a field has been set.
func (o *JsonWebKey) HasE() bool {
if o != nil && !IsNil(o.E) {
return true
}
return false
}
// SetE gets a reference to the given string and assigns it to the E field.
func (o *JsonWebKey) SetE(v string) {
o.E = &v
}
// GetK returns the K field value if set, zero value otherwise.
func (o *JsonWebKey) GetK() string {
if o == nil || IsNil(o.K) {
var ret string
return ret
}
return *o.K
}
// GetKOk returns a tuple with the K field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *JsonWebKey) GetKOk() (*string, bool) {
if o == nil || IsNil(o.K) {
return nil, false
}
return o.K, true
}
// HasK returns a boolean if a field has been set.
func (o *JsonWebKey) HasK() bool {
if o != nil && !IsNil(o.K) {
return true
}
return false
}
// SetK gets a reference to the given string and assigns it to the K field.
func (o *JsonWebKey) SetK(v string) {
o.K = &v
}
// GetKid returns the Kid field value
func (o *JsonWebKey) GetKid() string {
if o == nil {
var ret string
return ret
}
return o.Kid
}
// GetKidOk returns a tuple with the Kid field value
// and a boolean to check if the value has been set.
func (o *JsonWebKey) GetKidOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Kid, true
}
// SetKid sets field value
func (o *JsonWebKey) SetKid(v string) {
o.Kid = v
}
// GetKty returns the Kty field value
func (o *JsonWebKey) GetKty() string {
if o == nil {
var ret string
return ret
}
return o.Kty
}
// GetKtyOk returns a tuple with the Kty field value
// and a boolean to check if the value has been set.
func (o *JsonWebKey) GetKtyOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Kty, true
}
// SetKty sets field value
func (o *JsonWebKey) SetKty(v string) {
o.Kty = v
}
// GetN returns the N field value if set, zero value otherwise.
func (o *JsonWebKey) GetN() string {
if o == nil || IsNil(o.N) {
var ret string
return ret
}
return *o.N
}
// GetNOk returns a tuple with the N field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *JsonWebKey) GetNOk() (*string, bool) {
if o == nil || IsNil(o.N) {
return nil, false
}
return o.N, true
}
// HasN returns a boolean if a field has been set.
func (o *JsonWebKey) HasN() bool {
if o != nil && !IsNil(o.N) {
return true
}
return false
}
// SetN gets a reference to the given string and assigns it to the N field.
func (o *JsonWebKey) SetN(v string) {
o.N = &v
}
// GetP returns the P field value if set, zero value otherwise.
func (o *JsonWebKey) GetP() string {
if o == nil || IsNil(o.P) {
var ret string
return ret
}
return *o.P
}
// GetPOk returns a tuple with the P field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *JsonWebKey) GetPOk() (*string, bool) {
if o == nil || IsNil(o.P) {
return nil, false
}
return o.P, true
}
// HasP returns a boolean if a field has been set.
func (o *JsonWebKey) HasP() bool {
if o != nil && !IsNil(o.P) {
return true
}
return false
}
// SetP gets a reference to the given string and assigns it to the P field.
func (o *JsonWebKey) SetP(v string) {
o.P = &v
}
// GetQ returns the Q field value if set, zero value otherwise.
func (o *JsonWebKey) GetQ() string {
if o == nil || IsNil(o.Q) {
var ret string
return ret
}
return *o.Q
}
// GetQOk returns a tuple with the Q field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *JsonWebKey) GetQOk() (*string, bool) {
if o == nil || IsNil(o.Q) {
return nil, false
}
return o.Q, true
}
// HasQ returns a boolean if a field has been set.
func (o *JsonWebKey) HasQ() bool {
if o != nil && !IsNil(o.Q) {
return true
}
return false
}
// SetQ gets a reference to the given string and assigns it to the Q field.
func (o *JsonWebKey) SetQ(v string) {
o.Q = &v
}
// GetQi returns the Qi field value if set, zero value otherwise.
func (o *JsonWebKey) GetQi() string {
if o == nil || IsNil(o.Qi) {
var ret string
return ret
}
return *o.Qi
}
// GetQiOk returns a tuple with the Qi field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *JsonWebKey) GetQiOk() (*string, bool) {
if o == nil || IsNil(o.Qi) {
return nil, false
}
return o.Qi, true
}
// HasQi returns a boolean if a field has been set.
func (o *JsonWebKey) HasQi() bool {
if o != nil && !IsNil(o.Qi) {
return true
}
return false
}
// SetQi gets a reference to the given string and assigns it to the Qi field.
func (o *JsonWebKey) SetQi(v string) {
o.Qi = &v
}
// GetUse returns the Use field value
func (o *JsonWebKey) GetUse() string {
if o == nil {
var ret string
return ret
}
return o.Use
}
// GetUseOk returns a tuple with the Use field value
// and a boolean to check if the value has been set.
func (o *JsonWebKey) GetUseOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Use, true
}
// SetUse sets field value
func (o *JsonWebKey) SetUse(v string) {
o.Use = v
}
// GetX returns the X field value if set, zero value otherwise.
func (o *JsonWebKey) GetX() string {
if o == nil || IsNil(o.X) {
var ret string
return ret
}
return *o.X
}
// GetXOk returns a tuple with the X field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *JsonWebKey) GetXOk() (*string, bool) {
if o == nil || IsNil(o.X) {
return nil, false
}
return o.X, true
}
// HasX returns a boolean if a field has been set.
func (o *JsonWebKey) HasX() bool {
if o != nil && !IsNil(o.X) {
return true
}
return false
}
// SetX gets a reference to the given string and assigns it to the X field.
func (o *JsonWebKey) SetX(v string) {
o.X = &v
}
// GetX5c returns the X5c field value if set, zero value otherwise.
func (o *JsonWebKey) GetX5c() []string {
if o == nil || IsNil(o.X5c) {
var ret []string
return ret
}
return o.X5c
}
// GetX5cOk returns a tuple with the X5c field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *JsonWebKey) GetX5cOk() ([]string, bool) {
if o == nil || IsNil(o.X5c) {
return nil, false
}
return o.X5c, true
}
// HasX5c returns a boolean if a field has been set.
func (o *JsonWebKey) HasX5c() bool {
if o != nil && !IsNil(o.X5c) {
return true
}
return false
}
// SetX5c gets a reference to the given []string and assigns it to the X5c field.
func (o *JsonWebKey) SetX5c(v []string) {
o.X5c = v
}
// GetY returns the Y field value if set, zero value otherwise.
func (o *JsonWebKey) GetY() string {
if o == nil || IsNil(o.Y) {
var ret string
return ret
}
return *o.Y
}
// GetYOk returns a tuple with the Y field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *JsonWebKey) GetYOk() (*string, bool) {
if o == nil || IsNil(o.Y) {
return nil, false
}
return o.Y, true
}
// HasY returns a boolean if a field has been set.
func (o *JsonWebKey) HasY() bool {
if o != nil && !IsNil(o.Y) {
return true
}
return false
}
// SetY gets a reference to the given string and assigns it to the Y field.
func (o *JsonWebKey) SetY(v string) {
o.Y = &v
}
func (o JsonWebKey) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o JsonWebKey) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["alg"] = o.Alg
if !IsNil(o.Crv) {
toSerialize["crv"] = o.Crv
}
if !IsNil(o.D) {
toSerialize["d"] = o.D
}
if !IsNil(o.Dp) {
toSerialize["dp"] = o.Dp
}
if !IsNil(o.Dq) {
toSerialize["dq"] = o.Dq
}
if !IsNil(o.E) {
toSerialize["e"] = o.E
}
if !IsNil(o.K) {
toSerialize["k"] = o.K
}
toSerialize["kid"] = o.Kid
toSerialize["kty"] = o.Kty
if !IsNil(o.N) {
toSerialize["n"] = o.N
}
if !IsNil(o.P) {
toSerialize["p"] = o.P
}
if !IsNil(o.Q) {
toSerialize["q"] = o.Q
}
if !IsNil(o.Qi) {
toSerialize["qi"] = o.Qi
}
toSerialize["use"] = o.Use
if !IsNil(o.X) {
toSerialize["x"] = o.X
}
if !IsNil(o.X5c) {
toSerialize["x5c"] = o.X5c
}
if !IsNil(o.Y) {
toSerialize["y"] = o.Y
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *JsonWebKey) UnmarshalJSON(data []byte) (err error) {
// This validates that all required properties are included in the JSON object
// by unmarshalling the object into a generic map with string keys and checking
// that every required field exists as a key in the generic map.
requiredProperties := []string{
"alg",
"kid",
"kty",
"use",
}
allProperties := make(map[string]interface{})
err = json.Unmarshal(data, &allProperties)
if err != nil {
return err;
}
for _, requiredProperty := range(requiredProperties) {
if _, exists := allProperties[requiredProperty]; !exists {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
varJsonWebKey := _JsonWebKey{}
err = json.Unmarshal(data, &varJsonWebKey)
if err != nil {
return err
}
*o = JsonWebKey(varJsonWebKey)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "alg")
delete(additionalProperties, "crv")
delete(additionalProperties, "d")
delete(additionalProperties, "dp")
delete(additionalProperties, "dq")
delete(additionalProperties, "e")
delete(additionalProperties, "k")
delete(additionalProperties, "kid")
delete(additionalProperties, "kty")
delete(additionalProperties, "n")
delete(additionalProperties, "p")
delete(additionalProperties, "q")
delete(additionalProperties, "qi")
delete(additionalProperties, "use")
delete(additionalProperties, "x")
delete(additionalProperties, "x5c")
delete(additionalProperties, "y")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableJsonWebKey struct {
value *JsonWebKey
isSet bool
}
func (v NullableJsonWebKey) Get() *JsonWebKey {
return v.value
}
func (v *NullableJsonWebKey) Set(val *JsonWebKey) {
v.value = val
v.isSet = true
}
func (v NullableJsonWebKey) IsSet() bool {
return v.isSet
}
func (v *NullableJsonWebKey) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableJsonWebKey(val *JsonWebKey) *NullableJsonWebKey {
return &NullableJsonWebKey{value: val, isSet: true}
}
func (v NullableJsonWebKey) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableJsonWebKey) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}