Skip to content

Commit e6d2059

Browse files
authored
Rpc http cookies (#32)
* Rpc http cookies * richer types on cookie object
1 parent 8dde87f commit e6d2059

File tree

4 files changed

+69
-9
lines changed

4 files changed

+69
-9
lines changed

src/proto/FunctionRpc.proto

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ package AzureFunctionsRpcMessages;
1111

1212
import "google/protobuf/duration.proto";
1313
import "identity/ClaimsIdentityRpc.proto";
14+
import "shared/NullableTypes.proto";
1415

1516
// Interface exported by the server.
1617
service FunctionRpc {
@@ -375,6 +376,44 @@ message RpcException {
375376
string message = 2;
376377
}
377378

379+
// Http cookie type. Note that only name and value are used for Http requests
380+
message RpcHttpCookie {
381+
// Enum that lets servers require that a cookie shouoldn't be sent with cross-site requests
382+
enum SameSite {
383+
None = 0;
384+
Lax = 1;
385+
Strict = 2;
386+
}
387+
388+
// Cookie name
389+
string name = 1;
390+
391+
// Cookie value
392+
string value = 2;
393+
394+
// Specifies allowed hosts to receive the cookie
395+
NullableString domain = 3;
396+
397+
// Specifies URL path that must exist in the requested URL
398+
NullableString path = 4;
399+
400+
// Sets the cookie to expire at a specific date instead of when the client closes.
401+
// It is generally recommended that you use "Max-Age" over "Expires".
402+
NullableTimestamp expires = 5;
403+
404+
// Sets the cookie to only be sent with an encrypted request
405+
NullableBool secure = 6;
406+
407+
// Sets the cookie to be inaccessible to JavaScript's Document.cookie API
408+
NullableBool http_only = 7;
409+
410+
// Allows servers to assert that a cookie ought not to be sent along with cross-site requests
411+
SameSite same_site = 8;
412+
413+
// Number of seconds until the cookie expires. A zero or negative number will expire the cookie immediately.
414+
NullableDouble max_age = 9;
415+
}
416+
378417
// TODO - solidify this or remove it
379418
message RpcHttp {
380419
string method = 1;
@@ -387,4 +426,5 @@ message RpcHttp {
387426
bool enable_content_negotiation= 16;
388427
TypedData rawBody = 17;
389428
repeated RpcClaimsIdentity identities = 18;
429+
repeated RpcHttpCookie cookies = 19;
390430
}

src/proto/identity/ClaimsIdentityRpc.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
syntax = "proto3";
22
// protobuf vscode extension: https://marketplace.visualstudio.com/items?itemName=zxh404.vscode-proto3
33

4-
import "shared/NullableString.proto";
4+
import "shared/NullableTypes.proto";
55

66
// Light-weight representation of a .NET System.Security.Claims.ClaimsIdentity object.
77
// This is the same serialization as found in EasyAuth, and needs to be kept in sync with

src/proto/shared/NullableString.proto

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
syntax = "proto3";
2+
// protobuf vscode extension: https://marketplace.visualstudio.com/items?itemName=zxh404.vscode-proto3
3+
4+
import "google/protobuf/timestamp.proto";
5+
6+
message NullableString {
7+
oneof string {
8+
string value = 1;
9+
}
10+
}
11+
12+
message NullableDouble {
13+
oneof double {
14+
double value = 1;
15+
}
16+
}
17+
18+
message NullableBool {
19+
oneof bool {
20+
bool value = 1;
21+
}
22+
}
23+
24+
message NullableTimestamp {
25+
oneof timestamp {
26+
google.protobuf.Timestamp value = 1;
27+
}
28+
}

0 commit comments

Comments
 (0)