-
Notifications
You must be signed in to change notification settings - Fork 2
/
oauth2_client.go
781 lines (692 loc) · 29 KB
/
oauth2_client.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
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
// Code generated by go-swagger; DO NOT EDIT.
package oauth2
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
"github.com/go-openapi/strfmt"
)
// New creates a new oauth2 API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for oauth2 API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)
// ClientService is the interface for Client methods
type ClientService interface {
Authorize(params *AuthorizeParams, opts ...ClientOption) error
BackchannelAuthentication(params *BackchannelAuthenticationParams, opts ...ClientOption) (*BackchannelAuthenticationOK, error)
DeviceAuthorization(params *DeviceAuthorizationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceAuthorizationOK, error)
DynamicClientRegistration(params *DynamicClientRegistrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DynamicClientRegistrationCreated, error)
DynamicClientRegistrationDeleteClient(params *DynamicClientRegistrationDeleteClientParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DynamicClientRegistrationDeleteClientNoContent, error)
DynamicClientRegistrationGetClient(params *DynamicClientRegistrationGetClientParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DynamicClientRegistrationGetClientOK, error)
DynamicClientRegistrationUpdateClient(params *DynamicClientRegistrationUpdateClientParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DynamicClientRegistrationUpdateClientOK, error)
Introspect(params *IntrospectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*IntrospectOK, error)
Jwks(params *JwksParams, opts ...ClientOption) (*JwksOK, error)
PushedAuthorizationRequest(params *PushedAuthorizationRequestParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PushedAuthorizationRequestCreated, error)
Revoke(params *RevokeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RevokeOK, error)
RpInitiatedLogout(params *RpInitiatedLogoutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RpInitiatedLogoutOK, error)
RpInitiatedLogoutPost(params *RpInitiatedLogoutPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RpInitiatedLogoutPostOK, error)
Token(params *TokenParams, opts ...ClientOption) (*TokenOK, error)
Userinfo(params *UserinfoParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserinfoOK, error)
WellKnown(params *WellKnownParams, opts ...ClientOption) (*WellKnownOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
Authorize thes o auth 2 0 authorize endpoint
The authorization endpoint is used to interact with the resource
owner and obtain an authorization grant.
*/
func (a *Client) Authorize(params *AuthorizeParams, opts ...ClientOption) error {
// TODO: Validate the params before sending
if params == nil {
params = NewAuthorizeParams()
}
op := &runtime.ClientOperation{
ID: "authorize",
Method: "GET",
PathPattern: "/oauth2/authorize",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &AuthorizeReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
_, err := a.transport.Submit(op)
if err != nil {
return err
}
return nil
}
/*
BackchannelAuthentication opens ID connect client initiated backchannel authentication endpoint
Client-Initiated Backchannel Authentication defines an authentication request that is requested directly from the Client to the OpenID Provider without going through the user's browser.
*/
func (a *Client) BackchannelAuthentication(params *BackchannelAuthenticationParams, opts ...ClientOption) (*BackchannelAuthenticationOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewBackchannelAuthenticationParams()
}
op := &runtime.ClientOperation{
ID: "backchannelAuthentication",
Method: "POST",
PathPattern: "/backchannel/authentication",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"},
Schemes: []string{"https"},
Params: params,
Reader: &BackchannelAuthenticationReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*BackchannelAuthenticationOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for backchannelAuthentication: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
DeviceAuthorization os auth 2 0 device authorization endpoint
The Device Authorization endpoint is designed for Internet-
connected devices that either lack a browser to perform a user-agent-
based authorization or are input constrained to the extent that
requiring the user to input text in order to authenticate during the
authorization flow is impractical.
*/
func (a *Client) DeviceAuthorization(params *DeviceAuthorizationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceAuthorizationOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeviceAuthorizationParams()
}
op := &runtime.ClientOperation{
ID: "deviceAuthorization",
Method: "POST",
PathPattern: "/device/authorization",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"},
Schemes: []string{"https"},
Params: params,
Reader: &DeviceAuthorizationReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*DeviceAuthorizationOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for deviceAuthorization: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
DynamicClientRegistration os auth 2 0 dynamic client registration endpoint
Dynamic Client Registration endpoint allows to dynamically register OAuth 2.0 client applications
with the Cloudentity Platform. When a request with all required registration metadata
values reaches the Cloudentity authorization server, the server issues a client
identifier and provides client metadata values registered for the client.
Client applications can use their registration data to communicate with the Cloudentity
platform using the OAuth 2.0 protocol.
*/
func (a *Client) DynamicClientRegistration(params *DynamicClientRegistrationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DynamicClientRegistrationCreated, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDynamicClientRegistrationParams()
}
op := &runtime.ClientOperation{
ID: "dynamicClientRegistration",
Method: "POST",
PathPattern: "/oauth2/register",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &DynamicClientRegistrationReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*DynamicClientRegistrationCreated)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for dynamicClientRegistration: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
DynamicClientRegistrationDeleteClient os auth 2 0 dynamic client registration delete client endpoint
This endpoint allows to delete a dynamically registered client.
*/
func (a *Client) DynamicClientRegistrationDeleteClient(params *DynamicClientRegistrationDeleteClientParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DynamicClientRegistrationDeleteClientNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDynamicClientRegistrationDeleteClientParams()
}
op := &runtime.ClientOperation{
ID: "dynamicClientRegistrationDeleteClient",
Method: "DELETE",
PathPattern: "/oauth2/register/{cid}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &DynamicClientRegistrationDeleteClientReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*DynamicClientRegistrationDeleteClientNoContent)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for dynamicClientRegistrationDeleteClient: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
DynamicClientRegistrationGetClient os auth 2 0 dynamic client registration get client endpoint
This endpoint allows to get metadata values of a dynamically registered client.
*/
func (a *Client) DynamicClientRegistrationGetClient(params *DynamicClientRegistrationGetClientParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DynamicClientRegistrationGetClientOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDynamicClientRegistrationGetClientParams()
}
op := &runtime.ClientOperation{
ID: "dynamicClientRegistrationGetClient",
Method: "GET",
PathPattern: "/oauth2/register/{cid}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &DynamicClientRegistrationGetClientReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*DynamicClientRegistrationGetClientOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for dynamicClientRegistrationGetClient: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
DynamicClientRegistrationUpdateClient os auth 2 0 dynamic client registration update client endpoint
This endpoint allows to update metadata values of a dynamically registered client.
*/
func (a *Client) DynamicClientRegistrationUpdateClient(params *DynamicClientRegistrationUpdateClientParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DynamicClientRegistrationUpdateClientOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDynamicClientRegistrationUpdateClientParams()
}
op := &runtime.ClientOperation{
ID: "dynamicClientRegistrationUpdateClient",
Method: "PUT",
PathPattern: "/oauth2/register/{cid}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &DynamicClientRegistrationUpdateClientReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*DynamicClientRegistrationUpdateClientOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for dynamicClientRegistrationUpdateClient: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
Introspect thes o auth 2 0 introspection endpoint
Takes the `token` parameter representing an OAuth 2.0 token (the one the application wants to
introspect) and returns a JSON
representing the metadata surrounding the token such as, for example,
whether the token is still active, what are the approved access scopes, what is the
authentication context in which the token was issued.
Token introspection allows resource servers or applications to
query this information regardless of whether or not it is carried in
the token itself. It allows to use this method along with or
independently of structured token values. Additionally, you can use the mechanism to
introspect the token in a particular authentication context
and ascertain the relevant metadata about the token to make the
authorization decision appropriately.
Client applications that call the OAuth 2.0 Introspection Endpoint must authenticate with the
Cloudentity authorization server either with a valid access token provided as the value of
the `Authorization: Bearer $AT` request header or using the client authentication method
configured for the client application.
When a client application is assigned the `introspect_tokens` scope, it can introspect tokens
that belong to client applications **registered within the same workspace** as the client app
requesting the token instrospection. When a client application has no `introspect_tokens` scope
assigned, it can **only introspect its tokens**.
*/
func (a *Client) Introspect(params *IntrospectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*IntrospectOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewIntrospectParams()
}
op := &runtime.ClientOperation{
ID: "introspect",
Method: "POST",
PathPattern: "/oauth2/introspect",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"},
Schemes: []string{"https"},
Params: params,
Reader: &IntrospectReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*IntrospectOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for introspect: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
Jwks JSONs web keys discovery endpoint
This endpoint returns the signing key(s) the client uses to validate
signatures from the authorization server.
*/
func (a *Client) Jwks(params *JwksParams, opts ...ClientOption) (*JwksOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewJwksParams()
}
op := &runtime.ClientOperation{
ID: "jwks",
Method: "GET",
PathPattern: "/.well-known/jwks.json",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &JwksReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*JwksOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for jwks: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PushedAuthorizationRequest pusheds authorization request p a r endpoint
This endpoint allows clients to push the payload of an OAuth 2.0 authorization request to the authorization server
via a direct request and provides them with a request URI that is used as reference to the data in a subsequent call
to the authorization endpoint.
*/
func (a *Client) PushedAuthorizationRequest(params *PushedAuthorizationRequestParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PushedAuthorizationRequestCreated, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPushedAuthorizationRequestParams()
}
op := &runtime.ClientOperation{
ID: "pushedAuthorizationRequest",
Method: "POST",
PathPattern: "/par",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"},
Schemes: []string{"https"},
Params: params,
Reader: &PushedAuthorizationRequestReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*PushedAuthorizationRequestCreated)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for pushedAuthorizationRequest: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
Revoke thes o auth 2 0 revocation endpoint
Supports revocation of access and refresh tokens. The token to be revoked must be provided as the
value of the `token` parameter. When a token is revoked, it cannot be used to, for example,
exchange a refresh token to an access token.
Client applications that call the OAuth 2.0 Revocation Endpoint must authenticate with the
Cloudentity authorization server either
with a valid access token provided as the value of the `Authorization: Bearer $AT` request header
or using the client authentication method configured for the client application.
When a client application is assigned the `revoke_tokens` scope, it can revoke tokens
that belong to client applications **registered within the same workspace** as the client app
requesting the token revocation. When a client application has no `revoke_tokens` scope
assigned, it can **only revoke its tokens**.
*/
func (a *Client) Revoke(params *RevokeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RevokeOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewRevokeParams()
}
op := &runtime.ClientOperation{
ID: "revoke",
Method: "POST",
PathPattern: "/oauth2/revoke",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"},
Schemes: []string{"https"},
Params: params,
Reader: &RevokeReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*RevokeOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for revoke: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
RpInitiatedLogout os ID c 1 0 r p initiated logout endpoint
Perform RP-Initiated Logout. See
[OpenID Connect RP-Initiated Logout 1.0 spec](https://openid.net/specs/openid-connect-rpinitiated-1_0.html).
*/
func (a *Client) RpInitiatedLogout(params *RpInitiatedLogoutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RpInitiatedLogoutOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewRpInitiatedLogoutParams()
}
op := &runtime.ClientOperation{
ID: "rpInitiatedLogout",
Method: "GET",
PathPattern: "/oidc/logout",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"},
Schemes: []string{"https"},
Params: params,
Reader: &RpInitiatedLogoutReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*RpInitiatedLogoutOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for rpInitiatedLogout: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
RpInitiatedLogoutPost os ID c 1 0 r p initiated logout endpoint
Perform RP-Initiated Logout. See
[OpenID Connect RP-Initiated Logout 1.0 spec](https://openid.net/specs/openid-connect-rpinitiated-1_0.html).
*/
func (a *Client) RpInitiatedLogoutPost(params *RpInitiatedLogoutPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RpInitiatedLogoutPostOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewRpInitiatedLogoutPostParams()
}
op := &runtime.ClientOperation{
ID: "rpInitiatedLogoutPost",
Method: "POST",
PathPattern: "/oidc/logout",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"},
Schemes: []string{"https"},
Params: params,
Reader: &RpInitiatedLogoutPostReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*RpInitiatedLogoutPostOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for rpInitiatedLogoutPost: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
Token thes o auth 2 0 token endpoint
The token endpoint is used by the client to obtain an access token by
presenting its authorization grant or refresh token.
*/
func (a *Client) Token(params *TokenParams, opts ...ClientOption) (*TokenOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewTokenParams()
}
op := &runtime.ClientOperation{
ID: "token",
Method: "POST",
PathPattern: "/oauth2/token",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/x-www-form-urlencoded"},
Schemes: []string{"https"},
Params: params,
Reader: &TokenReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*TokenOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for token: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
Userinfo opens ID connect userinfo endpoint
The UserInfo Endpoint is an OAuth 2.0 Protected Resource that
returns Claims about the authenticated End-User. To obtain the requested
Claims about the End-User, the Client makes a request to the UserInfo Endpoint
using an Access Token obtained through OpenID Connect Authentication. These Claims
are represented by a JSON object that contains a collection of name and value
pairs for the Claims.
*/
func (a *Client) Userinfo(params *UserinfoParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserinfoOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewUserinfoParams()
}
op := &runtime.ClientOperation{
ID: "userinfo",
Method: "GET",
PathPattern: "/userinfo",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &UserinfoReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*UserinfoOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for userinfo: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
WellKnown opens ID connect discovery endpoint
Returns OpenID configuration.
*/
func (a *Client) WellKnown(params *WellKnownParams, opts ...ClientOption) (*WellKnownOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewWellKnownParams()
}
op := &runtime.ClientOperation{
ID: "wellKnown",
Method: "GET",
PathPattern: "/.well-known/openid-configuration",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"https"},
Params: params,
Reader: &WellKnownReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
}
for _, opt := range opts {
opt(op)
}
result, err := a.transport.Submit(op)
if err != nil {
return nil, err
}
success, ok := result.(*WellKnownOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for wellKnown: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}