forked from taskcluster/taskcluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0039.yml
118 lines (118 loc) · 4.21 KB
/
0039.yml
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
version: 39
description: web-server authorization codes phase 2
migrationScript: 0039-migration.sql
downgradeScript: 0039-downgrade.sql
methods:
authorization_codes_table_entities_load:
deprecated: true
description: See taskcluster-lib-entities
mode: read
serviceName: web_server
args: partition_key text, row_key text
returns: table (partition_key_out text, row_key_out text, value jsonb, version integer, etag uuid)
body: |-
begin
end
authorization_codes_table_entities_create:
deprecated: true
serviceName: web_server
description: See taskcluster-lib-entities
mode: write
args: pk text, rk text, properties jsonb, overwrite boolean, version integer
returns: uuid
body: |-
begin
raise exception 'unsuccessful create' using errcode = 'P0004';
end
authorization_codes_table_entities_remove:
deprecated: true
serviceName: web_server
description: See taskcluster-lib-entities
mode: write
args: partition_key text, row_key text
returns: table (etag uuid)
body: |-
begin
raise exception 'unsuccessful delete' using errcode = 'P0004';
end
authorization_codes_table_entities_modify:
deprecated: true
serviceName: web_server
description: See taskcluster-lib-entities
mode: write
args: partition_key text, row_key text, properties jsonb, version integer, old_etag uuid
returns: table (etag uuid)
body: |-
begin
raise exception 'unsuccessful update' using errcode = 'P0004';
end
authorization_codes_table_entities_scan:
deprecated: true
description: See taskcluster-lib-entities
mode: read
serviceName: web_server
args: pk text, rk text, condition text, size integer, page integer
returns: table (partition_key text, row_key text, value jsonb, version integer, etag uuid)
body: |-
begin
end
create_authorization_code:
description: |-
Create an authorization code.
mode: write
serviceName: web_server
args: code_in text, client_id_in text, redirect_uri_in text, identity_in text, identity_provider_id_in text, expires_in timestamptz, client_details_in jsonb
returns: table(code text, client_id text, redirect_uri text, identity text, identity_provider_id text, expires timestamptz, client_details jsonb)
body: |-
begin
return query insert
into authorization_codes (code, client_id, redirect_uri, identity, identity_provider_id, expires, client_details)
values (code_in, client_id_in, redirect_uri_in, identity_in, identity_provider_id_in, expires_in, client_details_in)
returning
authorization_codes.code,
authorization_codes.client_id,
authorization_codes.redirect_uri,
authorization_codes.identity,
authorization_codes.identity_provider_id,
authorization_codes.expires,
authorization_codes.client_details;
end
get_authorization_code:
description: Get an authorization code entry given a code.
mode: read
serviceName: web_server
args: code_in text
returns: table(code text, client_id text, redirect_uri text, identity text, identity_provider_id text, expires timestamptz, client_details jsonb)
body: |-
begin
return query
select
authorization_codes.code,
authorization_codes.client_id,
authorization_codes.redirect_uri,
authorization_codes.identity,
authorization_codes.identity_provider_id,
authorization_codes.expires,
authorization_codes.client_details
from authorization_codes
where authorization_codes.code = code_in;
end
expire_authorization_codes:
description: |-
Delete authorization codes that expire before `expires_in`.
Returns a count of rows that have been deleted.
mode: write
serviceName: web_server
args: expires_in timestamptz
returns: integer
body: |-
declare
count integer;
begin
delete from authorization_codes where authorization_codes.expires < expires_in;
if found then
get diagnostics count = row_count;
return count;
end if;
return 0;
end