-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathauth_config.proto
1656 lines (1413 loc) · 83.6 KB
/
auth_config.proto
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
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
syntax = "proto3";
package enterprise.gloo.solo.io;
option go_package = "github.com/solo-io/solo-apis/pkg/api/enterprise.gloo.solo.io/v1";
import "github.com/solo-io/solo-kit/api/v1/ref.proto";
import "extproto/ext.proto";
option (extproto.equal_all) = true;
option (extproto.hash_all) = true;
option (extproto.clone_all) = true;
import "github.com/solo-io/solo-kit/api/v1/solo-kit.proto";
import "github.com/solo-io/solo-kit/api/external/envoy/api/v2/discovery.proto";
import "google/api/annotations.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/empty.proto";
// This is the user-facing auth configuration. When processed by Gloo, certain configuration types (i.a. oauth, opa)
// will be translated, e.g. to resolve resource references. See the `ExtAuthConfig.AuthConfig` for the final config
// format that will be included in the extauth snapshot.
message AuthConfigSpec {
reserved 1;
message Config {
// optional: used when defining complex boolean logic, if `boolean_expr` is defined below. Also used
// in logging. If omitted, an automatically generated name will be used (e.g. config_0, of the
// pattern 'config_$INDEX_IN_CHAIN'). In the case of plugin auth, this field is ignored in favor of
// the name assigned on the plugin config itself.
google.protobuf.StringValue name = 9;
oneof auth_config {
// +kubebuilder:validation:XValidation:rule="has(self.apr) ? !has(self.encryption) && !has(self.userList) : has(self.encryption) && has(self.userList)",message="Either apr or both encryption and userSource must be set; apr may not be set alongside either encryption or userSource"
BasicAuth basic_auth = 1;
OAuth oauth = 2 [deprecated = true];
OAuth2 oauth2 = 8;
ApiKeyAuth api_key_auth = 4;
AuthPlugin plugin_auth = 5 [deprecated = true];
OpaAuth opa_auth = 6;
Ldap ldap = 7;
// This is a "dummy" extauth service which can be used to support multiple auth mechanisms with JWT authentication.
// If Jwt authentication is to be used in the [boolean expression](https://docs.solo.io/gloo-edge/latest/reference/api/github.com/solo-io/solo-apis/api/gloo/enterprise.gloo/v1/auth_config.proto.sk/#authconfig) in an AuthConfig, you can use this auth config type to include Jwt as an Auth config.
// In addition, `allow_missing_or_failed_jwt` must be set on the Virtual Host or Route that uses JWT auth or else the JWT filter will short circuit this behaviour.
google.protobuf.Empty jwt = 11;
// +kubebuilder:validation:XValidation:rule="has(self.grpc) || has(self.http)",message="Must specify grpc or http"
PassThroughAuth pass_through_auth = 12;
HmacAuth hmac_auth = 13;
OpaServerAuth opa_server_auth = 14;
PortalAuth portal_auth = 15;
}
}
// List of auth configs to be checked for requests on a route referencing this auth config,
// By default, every config must be authorized for the entire request to be authorized. This
// behavior can be changed by defining names for each config and defining `boolean_expr` below.
//
// State is shared between successful requests on the chain, i.e., the headers returned from each
// successful auth service get appended into the final auth response.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinItems=1
repeated Config configs = 3;
// How to handle processing of named configs within an auth config chain.
// An example config might be: `( basic1 || basic2 || (oidc1 && !oidc2) )`
// The boolean expression is evaluated left to right but honors parenthesis and short-circuiting.
google.protobuf.StringValue boolean_expr = 10;
// How the service should handle a redirect response from an OIDC issuer. In the default false mode,
// the redirect will be considered a successful response, and the client will receive a 302 with a location header.
// If this is set to true, the client will instead receive a 401 unauthorized response. This is useful in cases where
// API calls are being made or other such occurrences where the client cannot handle the redirect.
bool fail_on_redirect = 11;
}
// Auth configurations defined on virtual hosts, routes, and weighted destinations will be unmarshalled to this message.
message ExtAuthExtension {
oneof spec {
// Set to true to disable auth on the virtual host/route.
bool disable = 1;
// A reference to an AuthConfig. This is used to configure the Gloo Edge Enterprise extauth server.
core.solo.io.ResourceRef config_ref = 2;
// Use this field if you are running your own custom extauth server.
CustomAuth custom_auth = 3;
}
}
// Global external auth settings
message Settings {
// The upstream to ask about auth decisions
core.solo.io.ResourceRef extauthz_server_ref = 1;
oneof service_type {
// If this is set, communication to the upstream will be via HTTP and not GRPC (default).
HttpService http_service = 2;
// Optional, if set the communication to the upstream will be via GRPC.
GrpcService grpc_service = 11;
}
// If the auth server trusted id of the user, it will be set in this header.
// Specifically this means that this header will be sanitized form the incoming request.
string user_id_header = 3;
// Timeout for the ext auth service to respond. Defaults to 200ms
google.protobuf.Duration request_timeout = 4;
// In case of a failure or timeout querying the auth server, normally a request is denied.
// if this is set to true, the request will be allowed.
bool failure_mode_allow = 5;
// Set this if you also want to send the body of the request, and not just the headers.
BufferSettings request_body = 6;
// Clears route cache in order to allow the external authorization service to correctly affect
// routing decisions. Filter clears all cached routes when:
//
// 1. The field is set to *true*.
//
// 2. The status returned from the authorization service is a HTTP 200 or gRPC 0.
//
// 3. At least one *authorization response header* is added to the client request, or is used for
// altering another client request header.
//
bool clear_route_cache = 7;
// Sets the HTTP status that is returned to the client when there is a network error between the
// filter and the authorization server. The default status is HTTP 403 Forbidden.
// If set, this must be one of the following:
// - 100
// - 200 201 202 203 204 205 206 207 208 226
// - 300 301 302 303 304 305 307 308
// - 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 421 422 423 424 426 428 429 431
// - 500 501 502 503 504 505 506 507 508 510 511
uint32 status_on_error = 8;
// Describes the transport protocol version to use when connecting to the ext auth server.
enum ApiVersion {
// Use v3 API.
V3 = 0;
}
// Determines the API version for the `ext_authz` transport protocol that will be used by Envoy
// to communicate with the auth server. Defaults to `V2`. For more info, see the `transport_api_version` field
// [here](https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/filters/http/ext_authz/v3/ext_authz.proto#extensions-filters-http-ext-authz-v3-extauthz).
ApiVersion transport_api_version = 9;
// Optional additional prefix to use when emitting statistics.
// This allows to distinguish emitted statistics between configured ext_authz filters in an HTTP filter chain.
string stat_prefix = 10;
}
message GrpcService {
// Set the authority header when calling the GRPC service.
string authority = 1;
}
message HttpService {
// Sets a prefix to the value of authorization request header *Path*.
string path_prefix = 1;
message Request {
// These headers will be copied from the incoming request to the request going
// to the auth server. Note that in addition to the user's supplied matchers:
//
// 1. *Host*, *Method*, *Path* and *Content-Length* are automatically included to the list.
//
// 2. *Content-Length* will be set to 0 and the request to the authorization service will not have
// a message body.
repeated string allowed_headers = 1;
// These headers that will be included to the request to authorization service. Note that
// client request of the same key will be overridden.
map<string, string> headers_to_add = 2;
// Headers that match these regex patterns will be copied from the incoming request
// to the request going to the auth server.
repeated string allowed_headers_regex = 3;
}
Request request = 2;
message Response {
// When this is set, authorization response headers that have a header in this list will be added to the original client request and sent to the upstream.
// Note that coexistent headers will be overridden.
repeated string allowed_upstream_headers = 1;
// When this is set, authorization response headers in this list will be added to the client's response when the auth request is denied.
// Note that when this list is *not* set, all the authorization response headers, except *Authority
// (Host)* will be in the response to the client. When a header is included in this list, *Path*,
// *Status*, *Content-Length*, *WWW-Authenticate* and *Location* are automatically added.
repeated string allowed_client_headers = 2;
// When this is set, authorization response headers that have a correspondent match will be added to the client's response.
// Note that coexistent headers will be appended.
repeated string allowed_upstream_headers_to_append = 3;
}
Response response = 3;
}
// Configuration for buffering the request data.
message BufferSettings {
// Sets the maximum size of a message body that the filter will hold in memory. Envoy will return
// *HTTP 413* and will *not* initiate the authorization process when buffer reaches the number
// set in this field. Note that this setting will have precedence over failure_mode_allow.
// Defaults to 4KB.
uint32 max_request_bytes = 1;
// When this field is true, Envoy will buffer the message until *max_request_bytes* is reached.
// The authorization request will be dispatched and no 413 HTTP error will be returned by the
// filter.
bool allow_partial_message = 2;
// When this field is true, Envoy will send the body sent to the external authorization service with raw bytes.
bool pack_as_bytes = 3;
}
// Gloo is not expected to configure the ext auth server in this case.
// This is used with custom auth servers.
message CustomAuth {
// When a request matches the virtual host, route, or weighted destination on which this configuration is defined,
// Gloo will add the given context_extensions to the request that is sent to the external authorization server.
// This allows the server to base the auth decision on metadata that you define on the source of the request.
//
// This attribute is analogous to Envoy's config.filter.http.ext_authz.v2.CheckSettings. See the official
// [Envoy documentation](https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/filters/http/ext_authz/v3/ext_authz.proto#envoy-v3-api-msg-extensions-filters-http-ext-authz-v3-checksettings)
// for more details.
map<string, string> context_extensions = 1;
// [Enterprise-only]
// Only required in the case where multiple auth servers are configured in Settings
// This name must match a key in the named_extauth Settings.
string name = 2;
}
// **Deprecated**: The pluginAuth config type is deprecated and will be removed in a future release. Use passThroughAuth instead.
message AuthPlugin {
// Name of the plugin
string name = 1;
// Name of the compiled plugin file. If not specified, Gloo Edge will look for an ".so" file with same name as the plugin.
string plugin_file_name = 2;
// Name of the exported symbol that implements the plugin interface in the plugin.
// If not specified, defaults to the name of the plugin
string exported_symbol_name = 3;
// +kubebuilder:validation:Required
google.protobuf.Struct config = 4;
}
// This is the legacy/simple basic auth config. It supports the APR and SHA-1 hashing algorithms.
//
// When using basic auth, requests can pass only one `Authorization` header. You cannot use basic auth config in
// conjunction with other auth configs that rely on the `Authorization` header as well. In case of such a conflict,
// use a different type of auth config or configure a different header, such as `X-Auth`.
message BasicAuth {
string realm = 1;
// If 'apr' is defined, 'encryption' and 'user_source' must not be defined or the config will fail validation
message Apr {
// Message to store the salt and salted hashed password for a user
message SaltedHashedPassword {
// Salt used with the apr algorithm for the user
string salt = 1;
// Salted and hashed password for the user
string hashed_password = 2;
}
// Map of authorized usernames to stored credentials
map<string, SaltedHashedPassword> users = 2;
}
Apr apr = 2;
// Below here is the "extended" basic auth config. Hashing algorithm and user source are independent and configurable.
// It is required to define exactly one of 'apr' or ('encryption' and 'user_source') or the config will fail validation
// The encryption/hashing algorithm to use to store the password
message EncryptionType {
// Sha1 encryption type (https://datatracker.ietf.org/doc/html/rfc3174)
// Sha1 is considered insecure and is not recommended for production use
message Sha1 {}
// Apache specific iterated MD5 hashing: (https://httpd.apache.org/docs/2.4/misc/password_encryptions.html)
message Apr {}
oneof algorithm {
Apr apr = 1;
Sha1 sha1 = 2;
}
}
// The encryption type to use to store the password on the server
// If 'encryption' is defined, 'user_source' must be defined and the top level 'apr' field must not be defined or the config will fail validation
EncryptionType encryption = 3;
// Message to store user data. We need the salt and salted hashed password for each user
message User {
// Salt used with the hashing algorithm for the user
string salt = 1;
// Salted and hashed password for the user
string hashed_password = 2;
}
// Map of valid usernames to stored credentials
message UserList {
map<string, User> users= 1;
}
// Source of user credential data
// If 'user_source' is defined, 'encryption' must be defined and the top level 'apr'' field must not be defined or the config will fail validation
oneof user_source {
UserList user_list = 4;
}
}
// HMAC is a message authentication technique that can use multiple algorithms for finding credentials and generating signed messages.
// It conforms to https://www.ietf.org/rfc/rfc2104.txt
message HmacAuth {
// Configuration for how secrets are stored.
oneof secret_storage {
// +kubebuilder:validation:Required
SecretRefList secret_refs = 1;
}
// Algorithm to use to turn the request into a hashable string
oneof implementation_type{
HmacParametersInHeaders parameters_in_headers = 2;
}
}
message SecretRefList {
// list of secrets as registered with the issuer
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinItems=1
repeated core.solo.io.ResourceRef secret_refs = 1;
}
// Extract the HMAC parameters from the HTTP headers and use SHA-1 hashing
message HmacParametersInHeaders {}
// Deprecated: Prefer OAuth2
message OAuth {
// your client id as registered with the issuer
string client_id = 1 [deprecated = true];
// your client secret as registered with the issuer
core.solo.io.ResourceRef client_secret_ref = 2 [deprecated = true];
// The url of the issuer. We will look for OIDC information in issuerUrl+
// ".well-known/openid-configuration"
string issuer_url = 3 [deprecated = true];
// extra query parameters to apply to the Ext-Auth service's authorization request to the identity provider.
map<string, string> auth_endpoint_query_params = 7 [deprecated = true];
// we to redirect after successful auth, if we can't determine the original
// url this should be your publicly available app url.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
string app_url = 4 [deprecated = true];
// a callback path relative to app url that will be used for OIDC callbacks.
// needs to not be used by the application
string callback_path = 5 [deprecated = true];
// Scopes to request in addition to openid scope.
repeated string scopes = 6 [deprecated = true];
}
message OAuth2 {
oneof oauth_type {
// provide issuer location and let gloo handle OIDC flow for you.
// requests authorized by validating the contents of ID token.
// can also authorize the access token if configured.
//
// +kubebuilder:validation:XValidation:rule="has(self.clientAuthentication) ? !has(self.clientSecretRef) && !has(self.disableClientSecret) : has(self.clientSecretRef) || (has(self.disableClientSecret) && self.disableClientSecret)",message="If clientAuthentication is set, neither clientSecretRef nor disableClientSecret may be set. Otherwise, clientSecretRef must be set or disableClientSecret must be true."
OidcAuthorizationCode oidc_authorization_code = 1;
// provide the access token on the request and let gloo handle authorization.
//
// according to https://datatracker.ietf.org/doc/html/rfc6750 you can pass tokens through:
// - form-encoded body parameter. recommended, more likely to appear. e.g.: Authorization: Bearer mytoken123
// - URI query parameter e.g. access_token=mytoken123
// - and (preferably) secure cookies
AccessTokenValidation access_token_validation = 2;
// Enterprise-Only: THIS FEATURE IS IN TECH PREVIEW. APIs are versioned as alpha and subject to change.
// provide issuer location and let Gloo handle Oauth2 flow for you.
// requests authorized by validating the contents of access token.
// Prefer to use OIDC for better security.
//
// +kubebuilder:validation:XValidation:rule="has(self.clientSecretRef) || (has(self.disableClientSecret) && self.disableClientSecret)",message="Either clientSecretRef must be set or disableClientSecret must be true"
PlainOAuth2 oauth2 = 3;
}
}
message RedisOptions {
// address of the redis. can be address:port or unix://path/to/unix.sock
string host = 1;
// db to use. can leave unset for db 0.
int32 db = 2;
// size of the connection pool. can leave unset for default.
// defaults to 10 connections per every CPU
int32 pool_size = 3;
// enabled with a socket type of TLS. this is the tls cert mount path for this particular host.
// the generic secret can include the keys 'ca.crt', 'tls.crt', and 'tls.key'.
// the secret can contain the root-ca ,'ca.crt', at minimum. If a
// certificate is needed, both the 'tls.crt' and 'tls.key' need to be included.
// reference this to equal the 'mountPath' on the 'redis.certs[x].mountPath' in the helm chart values.
// an example of a mount path is '/certs'.
string tls_cert_mount_path = 4;
// redis socket types
enum SocketType {
// TCP connection socket, this is the default.
TCP = 0;
// TLS connection socket.
TLS = 1;
}
// the socket type, default is TCP.
SocketType socket_type = 5;
}
message UserSession {
message InternalSession {
// Refresh expired id-tokens using the refresh-token. The tokens refreshes when the client issues a call.
// Defaults to false. To enable refreshing, set to true.
google.protobuf.BoolValue allow_refreshing = 1;
// Prefix to append to cookie keys, such as for separate domain and subdomain prefixes.
// Cookie keys are stored in the form `<key_prefix>_<cookie_name>`.
// For more information, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes
string key_prefix = 2;
// Domain used to validate against requests in order to ensure that request host name matches target domain.
// If the target domain is provided will prevent requests that do not match the target domain according to
// the domain matching specifications in RFC 6265. For more information, see https://datatracker.ietf.org/doc/html/rfc6265#section-5.1.3
string target_domain = 3;
}
message RedisSession {
// Options to connect to redis
RedisOptions options = 1;
// Key prefix inside redis
string key_prefix = 2;
// Cookie name to set and store the session id. If empty the default "__session" is used.
string cookie_name = 3;
// Refresh expired id-tokens using the refresh-token. The tokens refreshes when the client issues a call.
// Defaults to true. To disable refreshing, set to false.
google.protobuf.BoolValue allow_refreshing = 4;
// Specifies a time buffer in which an id-token will be refreshed prior to its
// actual expiration. Defaults to 2 seconds. A duration of 0 will only refresh
// tokens after they have already expired. To refresh tokens, you must also set
// 'allowRefreshing' to 'true'; otherwise, this field is ignored.
google.protobuf.Duration pre_expiry_buffer = 5;
// Domain used to validate against requests in order to ensure that request host name matches target domain.
// If the target domain is provided will prevent requests that do not match the target domain according to
// the domain matching specifications in RFC 6265. For more information, see https://datatracker.ietf.org/doc/html/rfc6265#section-5.1.3
string target_domain = 6;
// If set, the name of the header that will include the randomly generated session id
// This would be used as part of the code exchange with the Oauth2 token endpoint
string header_name = 7;
}
// should we fail auth flow when failing to get a session from redis, or allow it to continue,
// potentially starting a new auth flow and setting a new session.
bool fail_on_fetch_failure = 1;
message CookieOptions {
// Max age for the cookie. Leave unset for a default of 30 days (2592000 seconds).
// To disable cookie expiry, set explicitly to 0.
google.protobuf.UInt32Value max_age = 1;
// Use a non-secure cookie. Note - this should only be used for testing and in trusted
// environments.
bool not_secure = 2;
// Set the cookie to be HttpOnly. defaults to true. Set explicity to false to disable.
google.protobuf.BoolValue http_only = 5;
// Path of the cookie. If unset, defaults to "/". Set it explicitly to "" to avoid setting a
// path.
google.protobuf.StringValue path = 3;
// The SameSite options. The default value is LaxMode.
enum SameSite {
// Default Mode is the same as LaxMode but will not show up in the Cookie Header. This value is ignored.
DefaultMode = 0;
// Cookies are not sent on normal cross-site subrequests, but are sent when
// navigating to the origin site.
LaxMode = 1;
// Only be sent in a first-party context and not be sent along with requests
// initiated by third party websites.
StrictMode = 2;
// Cookies are sent in all contexts. Cookie NotSecure must be unset.
NoneMode = 3;
}
// Whether the cookie should be restricted to a first-party or same-site context.
// The default mode is LaxMode.
SameSite same_site = 6;
// Cookie domain
string domain = 4;
}
// Set-Cookie options
CookieOptions cookie_options = 2;
oneof session {
// Set the tokens in the cookie itself. No need for server side state.
InternalSession cookie = 3;
// Use redis to store the tokens and just store a random id in the cookie.
RedisSession redis = 4;
}
// the cipher config is used to encrypt session cookie values. This is currently only available for OIDC.
message CipherConfig {
// to enable the cipher encryption, the key has to be present. Note that the key has to be found and 32 bytes in
// length for the authconfig to not be rejected.
oneof key {
// The key reference used for the cipher. The reference must be a Kubernetes Secret of type `gloo.solo.io.EncryptionKeySecret`.
core.solo.io.ResourceRef key_ref = 1;
}
}
// the cipher config enables the symmetric key encryption of the cookie values of the user session.
CipherConfig cipher_config = 5;
}
message HeaderConfiguration {
// If set, the id token will be forward upstream using this header name.
string id_token_header = 1;
// If set, the access token will be forward upstream using this header name.
string access_token_header = 2;
// If true, adds the "Bearer" prefix to the upstream access token header value.
google.protobuf.BoolValue use_bearer_schema_for_authorization = 3;
}
// OIDC configuration is discovered at <issuerUrl>/.well-known/openid-configuration
// The discovery override defines any properties that should override this discovery configuration
// https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata
message DiscoveryOverride {
// url of the provider authorization endpoint
string auth_endpoint = 1;
// url of the provider token endpoint
string token_endpoint = 2;
// url of the provider json web key set
string jwks_uri = 3;
// list of scope values that the provider supports
repeated string scopes = 4;
// list of response types that the provider supports
repeated string response_types = 5;
// list of subject identifier types that the provider supports
repeated string subjects = 6;
// list of json web signature signing algorithms that the provider supports for encoding claims in a jwt
repeated string id_token_algs = 7;
// list of client authentication methods supported by the provider token endpoint
repeated string auth_methods = 8;
// list of claim types that the provider supports
repeated string claims = 9;
// url of the provider token revocation endpoint
string revocation_endpoint = 10;
// url of the provider end session endpoint
string end_session_endpoint = 11;
}
// The json web key set (JWKS) (https://datatracker.ietf.org/doc/html/rfc7517) is discovered at an interval
// from a remote source. When keys rotate in the remote source, there may be a delay in the
// local source picking up those new keys. Therefore, a user could execute a request with a token
// that has been signed by a key in the remote JWKS, but the local cache doesn't have the key yet.
// The request would fail because the key isn't contained in the local set. Since most IdPs publish key
// keys in their remote JWKS before they are used, this is not an issue most of the time.
// This policy lets you define the behavior for when a user has a token with a key
// not yet in the local cache.
message JwksOnDemandCacheRefreshPolicy {
oneof policy {
// Never refresh the local JWKS cache on demand. If a key is not in the cache, it is assumed to be malicious.
// This is the default policy since we assume that IdPs publish keys before they rotate them,
// and frequent polling finds the newest keys.
google.protobuf.Empty never = 1;
// If a key is not in the cache, fetch the most recent keys from the IdP and update the cache.
// NOTE: This should only be done in trusted environments, since missing keys will each trigger
// a request to the IdP. Using this in an environment exposed to the internet will allow malicious agents to
// execute a DDoS attack by spamming protected endpoints with tokens signed by invalid keys.
google.protobuf.Empty always = 2;
// If a key is not in the cache, fetch the most recent keys from the IdP and update the cache.
// This value sets the number of requests to the IdP per polling interval. If that limit is exceeded,
// we will stop fetching from the IdP for the remainder of the polling interval.
uint32 max_idp_req_per_polling_interval = 3;
}
}
message AutoMapFromMetadata {
// The namespace from which to map metadata
string namespace = 1;
}
message EndSessionProperties {
// The Method used to make the request.
enum MethodType {
// Uses GET method when making the request
GetMethod = 0;
// Uses POST method when making the request
PostMethod = 1;
}
// The method type used by the end session endpoint, defaults to GET.
MethodType methodType = 1;
}
// Map a single claim from an OAuth2 or OIDC token to a header in the request to the upstream destination.
message ClaimToHeader {
// The claim name from the token, such as `sub`.
string claim = 1;
// The header to copy the claim to, such as `x-sub`.
string header = 2;
// If the header exists, append the claim value to the header (true), or overwrite any existing value (false). The default behavior is to overwrite any existing value (false).
bool append = 3;
}
// For apps in Microsoft Azure, configure Microsoft Entra ID as the OpenID Connect (OIDC) provider.
// This way, you can enable distributed claims and caching for when users are members of more than 200 groups.
message Azure {
// The client ID for the ExtAuthService app that is registered in MS Entra,
// to access the Microsoft Graph API to retrieve distributed claims.
// This app is NOT the app that you want to configure external auth for.
string client_id = 1;
// The tenant ID represents the MS Entra organization ID where the ExtAuthService app is registered.
// This tenant ID may or may not be the same as in the top level `OidcAuthorizationCodeConfig`,
// depending on how your Azure account is provisioned.
string tenant_id = 2;
// The client secret of the ExtAuthService app that is registered with MS Entra to communicate with the MS Graph API.
// The client secret data must be placed in a k8s secret under a key called 'client-secret'.
core.solo.io.ResourceRef client_secret = 3;
// Redis connection details to cache MS Entera claims.
// This way, you avoid performance issues of accessing the Microsoft Graph API too many times.
// Note that this setting does NOT turn on Redis caching for the user session.
// To turn on Redis user session caching, use the `userSessionConfig` field.
RedisOptions claims_caching_options = 4;
}
message OidcAuthorizationCode {
// your client id as registered with the issuer
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
string client_id = 1;
// your client secret as registered with the issuer.
// This is required unless `disable_client_secret` is true
// This field has been deprecated and can be set in the client_secret option of client_authentication
core.solo.io.ResourceRef client_secret_ref = 2 [deprecated = true];
// The url of the issuer. We will look for OIDC information in issuerUrl+
// ".well-known/openid-configuration"
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
string issuer_url = 3;
// extra query parameters to apply to the Ext-Auth service's authorization request to the identity provider.
// this can be useful for flows such as PKCE (https://www.oauth.com/oauth2-servers/pkce/authorization-request/)
// to set the `code_challenge` and `code_challenge_method`.
map<string, string> auth_endpoint_query_params = 4;
// extra query parameters to apply to the Ext-Auth service's token request to the identity provider.
// this can be useful for flows such as PKCE (https://www.oauth.com/oauth2-servers/pkce/authorization-request/)
// to set the `code_verifier`.
map<string, string> token_endpoint_query_params = 14;
// where to redirect after successful auth, if we can't determine the original url.
// this should be your publicly available app url.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
string app_url = 5;
// a callback path relative to app url that will be used for OIDC callbacks.
// should not be used by the application.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
string callback_path = 6;
// a path relative to app url that will be used for logging out from an OIDC session.
// should not be used by the application.
// If not provided, logout functionality will be disabled.
string logout_path = 9;
// url to redirect to after logout.
// This should be a publicly available URL. If not provided, will default to the `app_url`.
string after_logout_url = 15;
// Scopes to request in addition to openid scope.
repeated string scopes = 7;
// Configuration related to the user session.
UserSession session = 8;
// Configures headers added to requests.
HeaderConfiguration headers = 10;
// OIDC configuration is discovered at <issuerUrl>/.well-known/openid-configuration
// The discovery override defines any properties that should override this discovery configuration
// For example, the following AuthConfig CRD could be defined as:
// ```yaml
// apiVersion: enterprise.gloo.solo.io/v1
// kind: AuthConfig
// metadata:
// name: google-oidc
// namespace: gloo-system
// spec:
// configs:
// - oauth:
// app_url: http://localhost:8080
// callback_path: /callback
// client_id: $CLIENT_ID
// client_secret_ref:
// name: google
// namespace: gloo-system
// issuer_url: https://accounts.google.com
// discovery_override:
// token_endpoint: "https://token.url/gettoken"
// ```
//
// And this will ensure that regardless of what value is discovered at
// <issuerUrl>/.well-known/openid-configuration, "https://token.url/gettoken" will be used as the token endpoint
DiscoveryOverride discovery_override = 11;
// The interval at which OIDC configuration is discovered at <issuerUrl>/.well-known/openid-configuration
// If not specified, the default value is 30 minutes.
google.protobuf.Duration discovery_poll_interval = 12;
// If a user executes a request with a key that is not found in the JWKS, it could be
// that the keys have rotated on the remote source, and not yet in the local cache.
// This policy lets you define the behavior for how to refresh the local cache during a request
// where an invalid key is provided
JwksOnDemandCacheRefreshPolicy jwks_cache_refresh_policy = 13;
// in the future we may implement this:
// add optional configuration for validation of the access token received during the OIDC flow
// AccessTokenValidation access_token_validation = 8;
// DEPRECATED: Prefer the RedisSession.HeaderName field
// If set, the randomly generated session id will be sent to the token endpoint as part of the code exchange
// The session id is used as the key for sessions in Redis
string session_id_header_name = 16 [deprecated = true];
// If set, CallbackPath will be evaluated as a regular expression
bool parse_callback_path_as_regex = 17;
// If specified, authEndpointQueryParams and tokenEndpointQueryParams will be populated using dynamic metadata values.
// By default parameters will be extracted from the solo_authconfig_oidc namespace
// this behavior can be overridden by explicitly specifying a namespace
AutoMapFromMetadata auto_map_from_metadata = 18;
// If specified, these are properties defined for the end session endpoint
// specifications. Noted [here](https://openid.net/specs/openid-connect-rpinitiated-1_0.html)
// in the OIDC documentation.
EndSessionProperties end_session_properties = 19;
// Map of metadata key to claim. Ie:
// dynamic_metadata_from_claims:
// issuer: iss
// email: email
// When specified, the matching claims from the ID token will be emitted as dynamic metadata.
// Note that metadata keys must be unique, and the claim names must be alphanumeric and use `-` or `_` as separators.
// The metadata will live in a namespace specified by the canonical name of the ext auth filter (in our case `envoy.filters.http.ext_authz`),
// and the structure of the claim value will be preserved in the metadata struct.
map<string, string> dynamic_metadata_from_claims = 20;
// If true, do not check for or use the client secret.
// Generally the client secret is required and AuthConfigs will be rejected if it isn't set.
// However certain implementations of the PKCE flow do not use a client secret (including Okta) so this setting allows configuring Oidc without a client secret.
// This field has been deprecated and can be set in the client_secret option of client_authentication
google.protobuf.BoolValue disable_client_secret = 21 [deprecated = true];
// Optional: Configuration specific to the OAuth2 access token received and processed by the ext-auth-service.
AccessToken access_token = 23;
// Optional: Configuration specific to the OIDC identity token received and processed by the ext-auth-service.
IdentityToken identity_token = 24;
// Optional: Map a single claim from an OAuth2 access token to a header in the request to the upstream destination.
// Gloo Mesh products only: Note that if you want to clear the route cache to force the proxy to recalculate the
// routing destination after adding the claims, you must create an additional JwtPolicy or TransformationPolicy,
// and configure the `clearRouteCache` or `recalculateRoutingDestination` options.
message AccessToken {
// A list of claims to be mapped from the JWT token received by ext-auth-service to an upstream destination
repeated ClaimToHeader claims_to_headers = 1;
}
// Optional: Map a single claim from an OIDC identity token to a header in the request to the upstream destination.
message IdentityToken {
// A list of claims to be mapped from the JWT token received by ext-auth-service to an upstream destination
repeated ClaimToHeader claims_to_headers = 1;
}
// Configuration specific to the client authentication type used to exchange the access code for the access and id tokens.
message ClientAuthentication {
// Client Secret Authentication requires a client secret (unless it is disabled)
message ClientSecret {
// your client secret as registered with the issuer.
// This is required unless `disable_client_secret` is true
core.solo.io.ResourceRef client_secret_ref = 1;
// If true, do not check for or use the client secret.
// Generally the client secret is required and AuthConfigs will be rejected if it isn't set.
// However certain implementations of the PKCE flow do not use a client secret (including Okta) so this setting allows configuring Oidc without a client secret.
google.protobuf.BoolValue disable_client_secret = 2;
}
// Private Key JWT Authentication requires a signing key for the JWT and an duration for the JWT to be valid.
message PrivateKeyJwt{
// Signing key for the JWT used to authenticate the client
//
// +kubebuilder:validation:Required
core.solo.io.ResourceRef signing_key_ref = 1;
// Amount of time for which the JWT is valid. No maximum is enforced, but different IDPs may impose limits on how far in
// the future the expiration time is allowed to be. If omitted, default is 5s.
google.protobuf.Duration valid_for = 2;
}
// Configure how to authenticate the client
oneof client_authentication_config {
// Use the client secret method to authenticate the client
//
// +kubebuilder:validation:XValidation:rule="has(self.clientSecretRef) || (has(self.disableClientSecret) && self.disableClientSecret)",message="Either clientSecretRef must be set or disableClientSecret must be true"
ClientSecret client_secret = 1;
// Use the private ket JWT method to authenticate the client
PrivateKeyJwt private_key_jwt = 2;
}
}
// +kubebuilder:validation:XValidation:rule="has(self.clientSecret) || has(self.privateKeyJwt)",message="Must specify clientSecret or privateKeyJwt"
ClientAuthentication client_authentication = 25;
oneof Provider {
Default default = 26;
Azure azure = 27;
}
// No-op, represents default OIDC behavior
message Default {}
// For the moment this is just path, but we may want to configure things like iss/sid validation
message FrontChannelLogout {
// Path to use for front channel logout. Should not be the same as logout or callback paths.
string path=1;
}
// Configuration for front channel logout. This is used to log out the user from multiple apps/clients associated with one OpenId Provider (OP).
// The path is registered with the OP and is called for each app/client that the user is logged into when the logout endpoint is called.
FrontChannelLogout front_channel_logout = 28;
}
message PlainOAuth2 {
// Your client ID as registered with the issuer
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
string client_id = 1;
// Your client secret as registered with the issuer.
// This is required unless `disable_client_secret` is set.
core.solo.io.ResourceRef client_secret_ref = 2;
// Extra query parameters to apply to the Ext-Auth service's authorization request to the identity provider.
// These parameters can be useful for flows such as [PKCE](https://www.oauth.com/oauth2-servers/pkce/authorization-request/)
// to set the `code_challenge` and `code_challenge_method`.
map<string, string> auth_endpoint_query_params = 3;
// Where to redirect after successful auth, if Gloo can't determine the original URL.
// Set this field to your publicly available app URL.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
string app_url = 4;
// A callback path relative to the app URL to be used for OAuth2 callbacks.
// Do not use this path in the application itself.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
string callback_path = 5;
// Scopes to request for.
repeated string scopes = 6;
// Configuration related to the user session.
UserSession session = 7;
// A path relative to the app URL to use for logging out from an OAuth2 session.
// Do not use this path in the application itself.
// If not provided, logout functionality is disabled.
string logout_path = 8;
// Extra query parameters to apply to the Ext-Auth service's token request to the identity provider.
// These parameters can be useful for flows such as [PKCE](https://www.oauth.com/oauth2-servers/pkce/authorization-request/)
// to set the `code_verifier`.
map<string, string> token_endpoint_query_params = 9;
// URL to redirect to after logout.
// Set this field to a publicly available URL. If not provided, this value defaults to the `app_url` value.
string after_logout_url = 10;
// The URL of the provider authorization endpoint.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
string auth_endpoint = 11;
// The URL of the provider token endpoint.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
string token_endpoint = 12;
// The URL of the provider token revocation endpoint.
// For more information, refer to https://www.rfc-editor.org/rfc/rfc7009.
string revocation_endpoint = 13;
// If true, do not check for or use the client secret.
// Generally the client secret is required and AuthConfigs will be rejected if it isn't set.
// However certain implementations of the PKCE flow do not use a client secret (including Okta) so this setting allows configuring Oauth2 without a client secret.
google.protobuf.BoolValue disable_client_secret = 14;
}
// Defines how JSON Web Token (JWT) access tokens are validated.
//
// Tokens are validated using a JSON Web Key Set (as defined in
// [Section 5 of RFC7517](https://datatracker.ietf.org/doc/html/rfc7517#section-5)),
// which can be either inlined in the configuration or fetched from a remote location via HTTP.
// Any keys in the JWKS that are not intended for signature verification (i.e. whose
// ["use" parameter](https://datatracker.ietf.org/doc/html/rfc7517#section-4.2) is not "sig")
// will be ignored by the system, as will keys that do not specify a
// ["kid" (Key ID) parameter](https://datatracker.ietf.org/doc/html/rfc7517#section-4.2).
//
// The JWT to be validated must define non-empty "kid" and "alg" headers. The "kid" header
// determines which key in the JWKS will be used to verify the signature of the token;
// if no matching key is found, the token will be rejected.
//
// If present, the server will verify the "exp", "iat", and "nbf" standard JWT claims.
// Validation of the "iss" claim and of token scopes can be configured as well.
// If the JWT has been successfully validated, its set of claims will be added to the
// `AuthorizationRequest` state under the "jwtAccessToken" key.
message JwtValidation {
// Specifies how to fetch JWKS from remote and how to cache it.
message RemoteJwks {
// The HTTP URI to fetch the JWKS.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
string url = 1;
// The frequency at which the JWKS should be refreshed.
// If not specified, the default value is 5 minutes.
google.protobuf.Duration refresh_interval = 2;
}
// Represents a locally available JWKS.
message LocalJwks {
// JWKS is embedded as a string.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
string inline_string = 1;
}
oneof jwks_source_specifier {
// Fetches the JWKS from a remote location.
RemoteJwks remote_jwks = 1;
// Loads the JWKS from a local data source.
LocalJwks local_jwks = 2;
}
// Allow only tokens that have been issued by this principal (i.e. whose "iss" claim matches this value).
// If empty, issuer validation will be skipped.
string issuer = 3;
}
// Defines how (opaque) access tokens, received from the oauth authorization endpoint, are validated
// [OAuth2.0 Token Introspection](https://datatracker.ietf.org/doc/html/rfc7662)
//
// If the token introspection url requires client authentication, both the client_id and client_secret
// are required. Unless disable_client_secret is set, when only one is provided, the config will be rejected.
// These values will be encoded in a basic auth header in order to authenticate the client.
message IntrospectionValidation {
// The URL for the [OAuth2.0 Token Introspection](https://datatracker.ietf.org/doc/html/rfc7662) endpoint.
// If provided, the (opaque) access token provided or received from the oauth authorization endpoint
// will be validated against this endpoint, or locally cached responses for this access token.
//