@meshery/schemas 1.3.111 → 1.3.113

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,199 @@
1
+ 'use strict';var e={openapi:"3.0.0",info:{title:"OauthConsent",description:`OpenAPI schema for the OAuth consents of the signed-in user: the OAuth
2
+ clients (connected apps) the user has allowed to act on their behalf, and
3
+ the operation that withdraws that permission.
4
+
5
+ A consent is created by the authorization server's consent step, never by
6
+ a call defined here, so the construct has no write payload. It belongs to
7
+ the user and to one client. Unique key: (user, \`clientId\`) among live
8
+ consents: a user has at most one live consent per client. A re-consent by
9
+ the same user to a client with a live consent updates that consent in
10
+ place: its scopes are replaced and \`updatedAt\` advances, while \`id\` and
11
+ \`createdAt\` are kept.
12
+
13
+ A re-consent also changes the client's existing tokens; the rule is in
14
+ the description of the OauthConsent schema.
15
+
16
+ Both operations act only on the consents of the authenticated user; they
17
+ take no user in the path or the query, and a consent of another user is
18
+ never listed, never revealed and never revoked. Listing is for the
19
+ signed-in session only: a token-authenticated listing answers 403, because
20
+ the consents of other clients are not disclosed to a client.
21
+
22
+ Revoking a consent withdraws the user's permission for the client and
23
+ revokes every token the client holds for that user, so the client's next
24
+ call is refused and it must ask for consent again. A revoked consent is
25
+ soft-deleted (\`deletedAt\` set) and is no longer listed.
26
+ `,version:"v1beta3",contact:{name:"Meshery Maintainers",email:"maintainers@meshery.io",url:"https://meshery.io"},license:{name:"Apache 2.0",url:"https://www.apache.org/licenses/LICENSE-2.0.html"}},security:[{jwt:[]}],tags:[{name:"oauthConsents",description:"Operations related to the OAuth consents of the signed-in user."}],paths:{"/api/identity/oauth/consents":{get:{"x-internal":["cloud"],tags:["oauthConsents"],summary:"List OAuth consents",operationId:"getOauthConsents",description:`Returns a page of the live OAuth consents of the signed-in user, one
27
+ entry per client, ordered by updatedAt descending (a re-consent moves
28
+ a consent to the top). Revoked consents are
29
+ not listed. A user with no consented client receives an empty page.
30
+ \`scopes\` is the set the latest consent granted. A re-consent also
31
+ changes the client's existing tokens, as the OauthConsent schema
32
+ description states.
33
+
34
+ Only a request authenticated by the person's signed-in session may
35
+ list consents. A request authenticated by a token, of any kind, answers
36
+ 403 and lists nothing. The page holds the consents of every client the
37
+ user has allowed, so listing it to a client would disclose other
38
+ clients' consents to that client, which is why a token may not list.
39
+ `,parameters:[{name:"page",in:"query",description:"Get responses by page",schema:{type:"integer",minimum:0}},{name:"pageSize",in:"query",description:"Number of consents per page, at most 1000. Bounded here because the list is the signed-in user's whole consent set.",schema:{type:"integer",minimum:1,maximum:1e3}}],responses:{200:{description:"OAuth consents of the signed-in user",content:{"application/json":{schema:{type:"object",description:"Paginated collection of the signed-in user's live OAuth consents.",required:["page","pageSize","totalCount","oauthConsents"],properties:{page:{type:"integer",description:"Current page number of the result set.",minimum:0},pageSize:{type:"integer",description:"Number of items per page.",minimum:1},totalCount:{type:"integer",description:"Total number of items available.",minimum:0},oauthConsents:{type:"array",items:{"x-go-type":"OauthConsent",$schema:"http://json-schema.org/draft-07/schema#",title:"OAuth Consent Schema",description:`Server-returned OAuth consent: one OAuth client (a connected app) the
40
+ signed-in user has allowed to act on their behalf, with what it was granted.
41
+ Unique key: (user, \`clientId\`) among live consents (\`deletedAt\` null). A
42
+ user has at most one live consent per client, so \`clientId\` identifies the
43
+ consent among the user's own; \`id\` is the stored row's ID. The consent
44
+ names one root organization; the client acts only in that organization and
45
+ its descendants. Created by the authorization server's consent step and
46
+ soft-deleted by revoking it; there is no write payload. A re-consent by the
47
+ same user to a client with a live consent updates that consent in place:
48
+ its scopes are replaced and \`updatedAt\` advances, while \`id\` and
49
+ \`createdAt\` are kept.
50
+ A re-consent keeps the consent's \`organizationId\`. The consent moves to
51
+ another organization only when the user explicitly chooses that organization
52
+ on the consent screen. Then every existing token issued to that client for
53
+ that user is revoked in the same transaction, whatever its keychains, and this
54
+ overrides the token rules below. Tokens are never re-bound to a new
55
+ organization silently: the client gets a token for the new organization only
56
+ under the consent that names it.
57
+ A consent must name a keychain scope. The server refuses a first consent
58
+ in which no scope maps to a keychain in its scope map, with \`400\` and nothing
59
+ stored; a re-consent that names no keychain scope revokes (below). The schema cannot state this: \`scopes\` has minItems 1,
60
+ which stops only an empty list. The rule is enforced by the server against
61
+ the scope map, not by the schema. A scope string the scope map does not know
62
+ is refused with \`400\`, never silently dropped. Standard non-keychain scopes,
63
+ if the server accepts them at all (an open question), never count toward the
64
+ keychain-scope minimum. A token is never issued under a consent with an empty
65
+ keychain list, because a token limited to no keychains would hold no keys.
66
+ Re-consent changes the client's existing tokens, in the same transaction as
67
+ the consent update, by whether each token is scoped (\`keychainScoped\` true,
68
+ or a non-empty \`keychainIds\`). Every token matches exactly one branch:
69
+ - A scoped token gets \`keychainIds\` set to the
70
+ intersection of its keychains and the keychains of the new scopes. A
71
+ re-consent never adds keychains to a scoped token: a narrower re-consent
72
+ narrows it, and a broader one leaves it unchanged. A token whose
73
+ intersection is empty is revoked, not left with an empty list, because a
74
+ scoped token with no keychains holds no keys. This also holds when the token's
75
+ keychains were all deleted: its intersection is empty, so it is revoked,
76
+ and it never gains keys.
77
+ - An unrestricted token (\`keychainScoped\` false or absent and \`keychainIds\`
78
+ empty or absent) gets \`keychainIds\` set to
79
+ exactly the keychains of the new scopes, and \`keychainScoped\` set to true.
80
+ - A re-consent that names no keychain scope (only scopes
81
+ that map to no keychain) revokes: the consent is revoked (soft-deleted) and
82
+ every token issued to that client for that user is revoked, in the same
83
+ transaction. An unknown scope string is still refused with \`400\`.
84
+ A scope added by a re-consent takes effect only for tokens issued after that
85
+ consent, which is the user's fresh consent.
86
+ `,type:"object",additionalProperties:false,required:["id","clientId","clientName","scopes","organizationId","createdAt","updatedAt"],properties:{id:{description:"Server-generated consent ID.","x-go-name":"ID","x-oapi-codegen-extra-tags":{db:"id"},"x-order":1,type:"string",format:"uuid","x-go-type":"uuid.UUID","x-go-type-import":{path:"github.com/gofrs/uuid"}},clientId:{type:"string",description:"OAuth client ID the consent was granted to. An identifier issued by the authorization server, not a UUID. Unique per user among live consents.",minLength:1,maxLength:255,"x-id-format":"external","x-go-name":"ClientID","x-oapi-codegen-extra-tags":{db:"client_id"},"x-order":2},clientName:{type:"string",description:"Display name the client registered, shown to the user as the connected app's name.",minLength:1,maxLength:255,"x-oapi-codegen-extra-tags":{db:"client_name"},"x-order":3},clientUri:{type:"string",format:"uri",description:"Home page of the client, when it registered one. Omitted otherwise.",maxLength:2048,"x-oapi-codegen-extra-tags":{db:"client_uri",json:"clientUri,omitempty"},"x-order":4},logoUri:{type:"string",format:"uri",description:"Logo of the client, when it registered one. Omitted otherwise.",maxLength:2048,"x-oapi-codegen-extra-tags":{db:"logo_uri",json:"logoUri,omitempty"},"x-order":5},scopes:{type:"array",description:"Scopes the user granted the client, as the strings the authorization server issues. A scope names one keychain, so the client's tokens are limited to the keys of those keychains (see the token scoping contract). At least one scope must map to a keychain in the server's scope map. The server refuses (`400`, nothing stored) a first consent without one (a re-consent without one revokes the consent and the client's tokens), and refuses a scope string the scope map does not know; it never drops one silently. Standard non-keychain scopes never count toward that minimum. The schema enforces only that the list is not empty; the rule is enforced by the server against the scope map. See the description of this schema.",minItems:1,items:{type:"string",minLength:1,maxLength:255,pattern:"^\\S+$"},maxItems:100,uniqueItems:true,"x-go-type":"pq.StringArray","x-go-type-import":{path:"github.com/lib/pq"},"x-go-type-skip-optional-pointer":true,"x-oapi-codegen-extra-tags":{db:"scopes"},"x-order":6},organizationId:{description:"ID of the root organization the consent names. The client acts only in this organization and its descendants. A re-consent keeps it unless the user explicitly chooses another organization on the consent screen; see the description of this schema.","x-go-name":"OrganizationID","x-oapi-codegen-extra-tags":{db:"organization_id"},"x-order":7,type:"string",format:"uuid","x-go-type":"uuid.UUID","x-go-type-import":{path:"github.com/gofrs/uuid"}},createdAt:{description:"Time the user first granted the consent. A re-consent keeps it.",readOnly:true,"x-oapi-codegen-extra-tags":{db:"created_at"},"x-order":8,type:"string",format:"date-time","x-go-type-skip-optional-pointer":true},updatedAt:{description:"Time the consent was last granted or changed. Server-set: equal to `createdAt` when the consent is created, and advanced when the same user consents to the same live client again, which replaces `scopes`.",readOnly:true,"x-oapi-codegen-extra-tags":{db:"updated_at"},"x-order":9,type:"string",format:"date-time","x-go-type-skip-optional-pointer":true},lastUsedAt:{type:"string",format:"date-time",description:"Time the client last used a token issued under this consent. Null when the client has not used it yet or the server does not record use.",nullable:true,"x-go-type":"core.NullTime","x-go-type-import":{path:"github.com/meshery/schemas/models/core",name:"core"},"x-oapi-codegen-extra-tags":{db:"last_used_at",json:"lastUsedAt,omitempty"},"x-order":10},deletedAt:{description:"Time the consent was revoked (soft-deleted). Null while the consent is live. getOauthConsents returns live consents only.",nullable:true,"x-go-type":"core.NullTime","x-go-type-import":{name:"core",path:"github.com/meshery/schemas/models/core"},"x-oapi-codegen-extra-tags":{db:"deleted_at",json:"deletedAt,omitempty"},"x-order":11,type:"string",format:"date-time","x-go-type-skip-optional-pointer":true}}},description:"OAuth consents included on this page of results."}}}}}},400:{description:"Invalid request body or request param",content:{"text/plain":{schema:{type:"string"}}}},401:{description:"Expired JWT token used or insufficient privilege",content:{"text/plain":{schema:{type:"string"}}}},403:{description:"Forbidden",content:{"text/plain":{schema:{type:"string"}}}},500:{description:"Internal server error",content:{"text/plain":{schema:{type:"string"}}}}}},delete:{"x-internal":["cloud"],tags:["oauthConsents"],summary:"Revoke an OAuth consent",operationId:"deleteOauthConsent",description:`Revokes the signed-in user's consent for the client named by the
87
+ required \`clientId\` query parameter, and revokes every access and
88
+ refresh token that client holds for the user. The consents and tokens
89
+ of other users of the same client are untouched. Answers 204 with no
90
+ body. The consent is soft-deleted: its \`deletedAt\` is set and it is no
91
+ longer listed. For a session, and for a token naming its own client, a
92
+ client the user has no live consent for, whether it never existed, was
93
+ never consented to or was already revoked, is a 404.
94
+
95
+ Who may revoke depends on how the request is authenticated:
96
+ - A request authenticated by the person's signed-in session may revoke
97
+ any of that user's consents.
98
+ - A request authenticated by a token issued to an OAuth client may
99
+ revoke only the consent of the client the token was issued to. Naming
100
+ any other \`clientId\` answers 403 and changes nothing. The 403 does
101
+ not depend on whether that client has a live consent, so the answer
102
+ reveals nothing about another client.
103
+ - A personal API token, one not issued to an OAuth client, cannot revoke
104
+ a consent. Every such request answers 403 and changes nothing.
105
+ `,parameters:[{name:"clientId",in:"query",description:"OAuth client ID of the consent to revoke. An identifier issued by the authorization server, not a UUID.",required:true,schema:{type:"string",minLength:1,maxLength:255}}],responses:{204:{description:"OAuth consent revoked"},400:{description:"Invalid request body or request param",content:{"text/plain":{schema:{type:"string"}}}},401:{description:"Expired JWT token used or insufficient privilege",content:{"text/plain":{schema:{type:"string"}}}},403:{description:"Forbidden",content:{"text/plain":{schema:{type:"string"}}}},404:{description:"Result not found",content:{"text/plain":{schema:{type:"string"}}}},500:{description:"Internal server error",content:{"text/plain":{schema:{type:"string"}}}}}}}},components:{securitySchemes:{jwt:{type:"http",scheme:"bearer",bearerFormat:"JWT"}},responses:{400:{description:"Invalid request body or request param",content:{"text/plain":{schema:{type:"string"}}}},401:{description:"Expired JWT token used or insufficient privilege",content:{"text/plain":{schema:{type:"string"}}}},403:{description:"Forbidden",content:{"text/plain":{schema:{type:"string"}}}},404:{description:"Result not found",content:{"text/plain":{schema:{type:"string"}}}},500:{description:"Internal server error",content:{"text/plain":{schema:{type:"string"}}}}},parameters:{page:{name:"page",in:"query",description:"Get responses by page",schema:{type:"integer",minimum:0}},oauthConsentPageSize:{name:"pageSize",in:"query",description:"Number of consents per page, at most 1000. Bounded here because the list is the signed-in user's whole consent set.",schema:{type:"integer",minimum:1,maximum:1e3}},clientId:{name:"clientId",in:"query",description:"OAuth client ID of the consent to revoke. An identifier issued by the authorization server, not a UUID.",required:true,schema:{type:"string",minLength:1,maxLength:255}}},schemas:{OauthConsent:{$schema:"http://json-schema.org/draft-07/schema#",title:"OAuth Consent Schema",description:`Server-returned OAuth consent: one OAuth client (a connected app) the
106
+ signed-in user has allowed to act on their behalf, with what it was granted.
107
+ Unique key: (user, \`clientId\`) among live consents (\`deletedAt\` null). A
108
+ user has at most one live consent per client, so \`clientId\` identifies the
109
+ consent among the user's own; \`id\` is the stored row's ID. The consent
110
+ names one root organization; the client acts only in that organization and
111
+ its descendants. Created by the authorization server's consent step and
112
+ soft-deleted by revoking it; there is no write payload. A re-consent by the
113
+ same user to a client with a live consent updates that consent in place:
114
+ its scopes are replaced and \`updatedAt\` advances, while \`id\` and
115
+ \`createdAt\` are kept.
116
+ A re-consent keeps the consent's \`organizationId\`. The consent moves to
117
+ another organization only when the user explicitly chooses that organization
118
+ on the consent screen. Then every existing token issued to that client for
119
+ that user is revoked in the same transaction, whatever its keychains, and this
120
+ overrides the token rules below. Tokens are never re-bound to a new
121
+ organization silently: the client gets a token for the new organization only
122
+ under the consent that names it.
123
+ A consent must name a keychain scope. The server refuses a first consent
124
+ in which no scope maps to a keychain in its scope map, with \`400\` and nothing
125
+ stored; a re-consent that names no keychain scope revokes (below). The schema cannot state this: \`scopes\` has minItems 1,
126
+ which stops only an empty list. The rule is enforced by the server against
127
+ the scope map, not by the schema. A scope string the scope map does not know
128
+ is refused with \`400\`, never silently dropped. Standard non-keychain scopes,
129
+ if the server accepts them at all (an open question), never count toward the
130
+ keychain-scope minimum. A token is never issued under a consent with an empty
131
+ keychain list, because a token limited to no keychains would hold no keys.
132
+ Re-consent changes the client's existing tokens, in the same transaction as
133
+ the consent update, by whether each token is scoped (\`keychainScoped\` true,
134
+ or a non-empty \`keychainIds\`). Every token matches exactly one branch:
135
+ - A scoped token gets \`keychainIds\` set to the
136
+ intersection of its keychains and the keychains of the new scopes. A
137
+ re-consent never adds keychains to a scoped token: a narrower re-consent
138
+ narrows it, and a broader one leaves it unchanged. A token whose
139
+ intersection is empty is revoked, not left with an empty list, because a
140
+ scoped token with no keychains holds no keys. This also holds when the token's
141
+ keychains were all deleted: its intersection is empty, so it is revoked,
142
+ and it never gains keys.
143
+ - An unrestricted token (\`keychainScoped\` false or absent and \`keychainIds\`
144
+ empty or absent) gets \`keychainIds\` set to
145
+ exactly the keychains of the new scopes, and \`keychainScoped\` set to true.
146
+ - A re-consent that names no keychain scope (only scopes
147
+ that map to no keychain) revokes: the consent is revoked (soft-deleted) and
148
+ every token issued to that client for that user is revoked, in the same
149
+ transaction. An unknown scope string is still refused with \`400\`.
150
+ A scope added by a re-consent takes effect only for tokens issued after that
151
+ consent, which is the user's fresh consent.
152
+ `,type:"object",additionalProperties:false,required:["id","clientId","clientName","scopes","organizationId","createdAt","updatedAt"],properties:{id:{description:"Server-generated consent ID.","x-go-name":"ID","x-oapi-codegen-extra-tags":{db:"id"},"x-order":1,type:"string",format:"uuid","x-go-type":"uuid.UUID","x-go-type-import":{path:"github.com/gofrs/uuid"}},clientId:{type:"string",description:"OAuth client ID the consent was granted to. An identifier issued by the authorization server, not a UUID. Unique per user among live consents.",minLength:1,maxLength:255,"x-id-format":"external","x-go-name":"ClientID","x-oapi-codegen-extra-tags":{db:"client_id"},"x-order":2},clientName:{type:"string",description:"Display name the client registered, shown to the user as the connected app's name.",minLength:1,maxLength:255,"x-oapi-codegen-extra-tags":{db:"client_name"},"x-order":3},clientUri:{type:"string",format:"uri",description:"Home page of the client, when it registered one. Omitted otherwise.",maxLength:2048,"x-oapi-codegen-extra-tags":{db:"client_uri",json:"clientUri,omitempty"},"x-order":4},logoUri:{type:"string",format:"uri",description:"Logo of the client, when it registered one. Omitted otherwise.",maxLength:2048,"x-oapi-codegen-extra-tags":{db:"logo_uri",json:"logoUri,omitempty"},"x-order":5},scopes:{type:"array",description:"Scopes the user granted the client, as the strings the authorization server issues. A scope names one keychain, so the client's tokens are limited to the keys of those keychains (see the token scoping contract). At least one scope must map to a keychain in the server's scope map. The server refuses (`400`, nothing stored) a first consent without one (a re-consent without one revokes the consent and the client's tokens), and refuses a scope string the scope map does not know; it never drops one silently. Standard non-keychain scopes never count toward that minimum. The schema enforces only that the list is not empty; the rule is enforced by the server against the scope map. See the description of this schema.",minItems:1,items:{type:"string",minLength:1,maxLength:255,pattern:"^\\S+$"},maxItems:100,uniqueItems:true,"x-go-type":"pq.StringArray","x-go-type-import":{path:"github.com/lib/pq"},"x-go-type-skip-optional-pointer":true,"x-oapi-codegen-extra-tags":{db:"scopes"},"x-order":6},organizationId:{description:"ID of the root organization the consent names. The client acts only in this organization and its descendants. A re-consent keeps it unless the user explicitly chooses another organization on the consent screen; see the description of this schema.","x-go-name":"OrganizationID","x-oapi-codegen-extra-tags":{db:"organization_id"},"x-order":7,type:"string",format:"uuid","x-go-type":"uuid.UUID","x-go-type-import":{path:"github.com/gofrs/uuid"}},createdAt:{description:"Time the user first granted the consent. A re-consent keeps it.",readOnly:true,"x-oapi-codegen-extra-tags":{db:"created_at"},"x-order":8,type:"string",format:"date-time","x-go-type-skip-optional-pointer":true},updatedAt:{description:"Time the consent was last granted or changed. Server-set: equal to `createdAt` when the consent is created, and advanced when the same user consents to the same live client again, which replaces `scopes`.",readOnly:true,"x-oapi-codegen-extra-tags":{db:"updated_at"},"x-order":9,type:"string",format:"date-time","x-go-type-skip-optional-pointer":true},lastUsedAt:{type:"string",format:"date-time",description:"Time the client last used a token issued under this consent. Null when the client has not used it yet or the server does not record use.",nullable:true,"x-go-type":"core.NullTime","x-go-type-import":{path:"github.com/meshery/schemas/models/core",name:"core"},"x-oapi-codegen-extra-tags":{db:"last_used_at",json:"lastUsedAt,omitempty"},"x-order":10},deletedAt:{description:"Time the consent was revoked (soft-deleted). Null while the consent is live. getOauthConsents returns live consents only.",nullable:true,"x-go-type":"core.NullTime","x-go-type-import":{name:"core",path:"github.com/meshery/schemas/models/core"},"x-oapi-codegen-extra-tags":{db:"deleted_at",json:"deletedAt,omitempty"},"x-order":11,type:"string",format:"date-time","x-go-type-skip-optional-pointer":true}}},OauthConsentPage:{type:"object",description:"Paginated collection of the signed-in user's live OAuth consents.",required:["page","pageSize","totalCount","oauthConsents"],properties:{page:{type:"integer",description:"Current page number of the result set.",minimum:0},pageSize:{type:"integer",description:"Number of items per page.",minimum:1},totalCount:{type:"integer",description:"Total number of items available.",minimum:0},oauthConsents:{type:"array",items:{"x-go-type":"OauthConsent",$schema:"http://json-schema.org/draft-07/schema#",title:"OAuth Consent Schema",description:`Server-returned OAuth consent: one OAuth client (a connected app) the
153
+ signed-in user has allowed to act on their behalf, with what it was granted.
154
+ Unique key: (user, \`clientId\`) among live consents (\`deletedAt\` null). A
155
+ user has at most one live consent per client, so \`clientId\` identifies the
156
+ consent among the user's own; \`id\` is the stored row's ID. The consent
157
+ names one root organization; the client acts only in that organization and
158
+ its descendants. Created by the authorization server's consent step and
159
+ soft-deleted by revoking it; there is no write payload. A re-consent by the
160
+ same user to a client with a live consent updates that consent in place:
161
+ its scopes are replaced and \`updatedAt\` advances, while \`id\` and
162
+ \`createdAt\` are kept.
163
+ A re-consent keeps the consent's \`organizationId\`. The consent moves to
164
+ another organization only when the user explicitly chooses that organization
165
+ on the consent screen. Then every existing token issued to that client for
166
+ that user is revoked in the same transaction, whatever its keychains, and this
167
+ overrides the token rules below. Tokens are never re-bound to a new
168
+ organization silently: the client gets a token for the new organization only
169
+ under the consent that names it.
170
+ A consent must name a keychain scope. The server refuses a first consent
171
+ in which no scope maps to a keychain in its scope map, with \`400\` and nothing
172
+ stored; a re-consent that names no keychain scope revokes (below). The schema cannot state this: \`scopes\` has minItems 1,
173
+ which stops only an empty list. The rule is enforced by the server against
174
+ the scope map, not by the schema. A scope string the scope map does not know
175
+ is refused with \`400\`, never silently dropped. Standard non-keychain scopes,
176
+ if the server accepts them at all (an open question), never count toward the
177
+ keychain-scope minimum. A token is never issued under a consent with an empty
178
+ keychain list, because a token limited to no keychains would hold no keys.
179
+ Re-consent changes the client's existing tokens, in the same transaction as
180
+ the consent update, by whether each token is scoped (\`keychainScoped\` true,
181
+ or a non-empty \`keychainIds\`). Every token matches exactly one branch:
182
+ - A scoped token gets \`keychainIds\` set to the
183
+ intersection of its keychains and the keychains of the new scopes. A
184
+ re-consent never adds keychains to a scoped token: a narrower re-consent
185
+ narrows it, and a broader one leaves it unchanged. A token whose
186
+ intersection is empty is revoked, not left with an empty list, because a
187
+ scoped token with no keychains holds no keys. This also holds when the token's
188
+ keychains were all deleted: its intersection is empty, so it is revoked,
189
+ and it never gains keys.
190
+ - An unrestricted token (\`keychainScoped\` false or absent and \`keychainIds\`
191
+ empty or absent) gets \`keychainIds\` set to
192
+ exactly the keychains of the new scopes, and \`keychainScoped\` set to true.
193
+ - A re-consent that names no keychain scope (only scopes
194
+ that map to no keychain) revokes: the consent is revoked (soft-deleted) and
195
+ every token issued to that client for that user is revoked, in the same
196
+ transaction. An unknown scope string is still refused with \`400\`.
197
+ A scope added by a re-consent takes effect only for tokens issued after that
198
+ consent, which is the user's fresh consent.
199
+ `,type:"object",additionalProperties:false,required:["id","clientId","clientName","scopes","organizationId","createdAt","updatedAt"],properties:{id:{description:"Server-generated consent ID.","x-go-name":"ID","x-oapi-codegen-extra-tags":{db:"id"},"x-order":1,type:"string",format:"uuid","x-go-type":"uuid.UUID","x-go-type-import":{path:"github.com/gofrs/uuid"}},clientId:{type:"string",description:"OAuth client ID the consent was granted to. An identifier issued by the authorization server, not a UUID. Unique per user among live consents.",minLength:1,maxLength:255,"x-id-format":"external","x-go-name":"ClientID","x-oapi-codegen-extra-tags":{db:"client_id"},"x-order":2},clientName:{type:"string",description:"Display name the client registered, shown to the user as the connected app's name.",minLength:1,maxLength:255,"x-oapi-codegen-extra-tags":{db:"client_name"},"x-order":3},clientUri:{type:"string",format:"uri",description:"Home page of the client, when it registered one. Omitted otherwise.",maxLength:2048,"x-oapi-codegen-extra-tags":{db:"client_uri",json:"clientUri,omitempty"},"x-order":4},logoUri:{type:"string",format:"uri",description:"Logo of the client, when it registered one. Omitted otherwise.",maxLength:2048,"x-oapi-codegen-extra-tags":{db:"logo_uri",json:"logoUri,omitempty"},"x-order":5},scopes:{type:"array",description:"Scopes the user granted the client, as the strings the authorization server issues. A scope names one keychain, so the client's tokens are limited to the keys of those keychains (see the token scoping contract). At least one scope must map to a keychain in the server's scope map. The server refuses (`400`, nothing stored) a first consent without one (a re-consent without one revokes the consent and the client's tokens), and refuses a scope string the scope map does not know; it never drops one silently. Standard non-keychain scopes never count toward that minimum. The schema enforces only that the list is not empty; the rule is enforced by the server against the scope map. See the description of this schema.",minItems:1,items:{type:"string",minLength:1,maxLength:255,pattern:"^\\S+$"},maxItems:100,uniqueItems:true,"x-go-type":"pq.StringArray","x-go-type-import":{path:"github.com/lib/pq"},"x-go-type-skip-optional-pointer":true,"x-oapi-codegen-extra-tags":{db:"scopes"},"x-order":6},organizationId:{description:"ID of the root organization the consent names. The client acts only in this organization and its descendants. A re-consent keeps it unless the user explicitly chooses another organization on the consent screen; see the description of this schema.","x-go-name":"OrganizationID","x-oapi-codegen-extra-tags":{db:"organization_id"},"x-order":7,type:"string",format:"uuid","x-go-type":"uuid.UUID","x-go-type-import":{path:"github.com/gofrs/uuid"}},createdAt:{description:"Time the user first granted the consent. A re-consent keeps it.",readOnly:true,"x-oapi-codegen-extra-tags":{db:"created_at"},"x-order":8,type:"string",format:"date-time","x-go-type-skip-optional-pointer":true},updatedAt:{description:"Time the consent was last granted or changed. Server-set: equal to `createdAt` when the consent is created, and advanced when the same user consents to the same live client again, which replaces `scopes`.",readOnly:true,"x-oapi-codegen-extra-tags":{db:"updated_at"},"x-order":9,type:"string",format:"date-time","x-go-type-skip-optional-pointer":true},lastUsedAt:{type:"string",format:"date-time",description:"Time the client last used a token issued under this consent. Null when the client has not used it yet or the server does not record use.",nullable:true,"x-go-type":"core.NullTime","x-go-type-import":{path:"github.com/meshery/schemas/models/core",name:"core"},"x-oapi-codegen-extra-tags":{db:"last_used_at",json:"lastUsedAt,omitempty"},"x-order":10},deletedAt:{description:"Time the consent was revoked (soft-deleted). Null while the consent is live. getOauthConsents returns live consents only.",nullable:true,"x-go-type":"core.NullTime","x-go-type-import":{name:"core",path:"github.com/meshery/schemas/models/core"},"x-oapi-codegen-extra-tags":{db:"deleted_at",json:"deletedAt,omitempty"},"x-order":11,type:"string",format:"date-time","x-go-type-skip-optional-pointer":true}}},description:"OAuth consents included on this page of results."}}}}}},t=e;module.exports=t;
@@ -0,0 +1,199 @@
1
+ var e={openapi:"3.0.0",info:{title:"OauthConsent",description:`OpenAPI schema for the OAuth consents of the signed-in user: the OAuth
2
+ clients (connected apps) the user has allowed to act on their behalf, and
3
+ the operation that withdraws that permission.
4
+
5
+ A consent is created by the authorization server's consent step, never by
6
+ a call defined here, so the construct has no write payload. It belongs to
7
+ the user and to one client. Unique key: (user, \`clientId\`) among live
8
+ consents: a user has at most one live consent per client. A re-consent by
9
+ the same user to a client with a live consent updates that consent in
10
+ place: its scopes are replaced and \`updatedAt\` advances, while \`id\` and
11
+ \`createdAt\` are kept.
12
+
13
+ A re-consent also changes the client's existing tokens; the rule is in
14
+ the description of the OauthConsent schema.
15
+
16
+ Both operations act only on the consents of the authenticated user; they
17
+ take no user in the path or the query, and a consent of another user is
18
+ never listed, never revealed and never revoked. Listing is for the
19
+ signed-in session only: a token-authenticated listing answers 403, because
20
+ the consents of other clients are not disclosed to a client.
21
+
22
+ Revoking a consent withdraws the user's permission for the client and
23
+ revokes every token the client holds for that user, so the client's next
24
+ call is refused and it must ask for consent again. A revoked consent is
25
+ soft-deleted (\`deletedAt\` set) and is no longer listed.
26
+ `,version:"v1beta3",contact:{name:"Meshery Maintainers",email:"maintainers@meshery.io",url:"https://meshery.io"},license:{name:"Apache 2.0",url:"https://www.apache.org/licenses/LICENSE-2.0.html"}},security:[{jwt:[]}],tags:[{name:"oauthConsents",description:"Operations related to the OAuth consents of the signed-in user."}],paths:{"/api/identity/oauth/consents":{get:{"x-internal":["cloud"],tags:["oauthConsents"],summary:"List OAuth consents",operationId:"getOauthConsents",description:`Returns a page of the live OAuth consents of the signed-in user, one
27
+ entry per client, ordered by updatedAt descending (a re-consent moves
28
+ a consent to the top). Revoked consents are
29
+ not listed. A user with no consented client receives an empty page.
30
+ \`scopes\` is the set the latest consent granted. A re-consent also
31
+ changes the client's existing tokens, as the OauthConsent schema
32
+ description states.
33
+
34
+ Only a request authenticated by the person's signed-in session may
35
+ list consents. A request authenticated by a token, of any kind, answers
36
+ 403 and lists nothing. The page holds the consents of every client the
37
+ user has allowed, so listing it to a client would disclose other
38
+ clients' consents to that client, which is why a token may not list.
39
+ `,parameters:[{name:"page",in:"query",description:"Get responses by page",schema:{type:"integer",minimum:0}},{name:"pageSize",in:"query",description:"Number of consents per page, at most 1000. Bounded here because the list is the signed-in user's whole consent set.",schema:{type:"integer",minimum:1,maximum:1e3}}],responses:{200:{description:"OAuth consents of the signed-in user",content:{"application/json":{schema:{type:"object",description:"Paginated collection of the signed-in user's live OAuth consents.",required:["page","pageSize","totalCount","oauthConsents"],properties:{page:{type:"integer",description:"Current page number of the result set.",minimum:0},pageSize:{type:"integer",description:"Number of items per page.",minimum:1},totalCount:{type:"integer",description:"Total number of items available.",minimum:0},oauthConsents:{type:"array",items:{"x-go-type":"OauthConsent",$schema:"http://json-schema.org/draft-07/schema#",title:"OAuth Consent Schema",description:`Server-returned OAuth consent: one OAuth client (a connected app) the
40
+ signed-in user has allowed to act on their behalf, with what it was granted.
41
+ Unique key: (user, \`clientId\`) among live consents (\`deletedAt\` null). A
42
+ user has at most one live consent per client, so \`clientId\` identifies the
43
+ consent among the user's own; \`id\` is the stored row's ID. The consent
44
+ names one root organization; the client acts only in that organization and
45
+ its descendants. Created by the authorization server's consent step and
46
+ soft-deleted by revoking it; there is no write payload. A re-consent by the
47
+ same user to a client with a live consent updates that consent in place:
48
+ its scopes are replaced and \`updatedAt\` advances, while \`id\` and
49
+ \`createdAt\` are kept.
50
+ A re-consent keeps the consent's \`organizationId\`. The consent moves to
51
+ another organization only when the user explicitly chooses that organization
52
+ on the consent screen. Then every existing token issued to that client for
53
+ that user is revoked in the same transaction, whatever its keychains, and this
54
+ overrides the token rules below. Tokens are never re-bound to a new
55
+ organization silently: the client gets a token for the new organization only
56
+ under the consent that names it.
57
+ A consent must name a keychain scope. The server refuses a first consent
58
+ in which no scope maps to a keychain in its scope map, with \`400\` and nothing
59
+ stored; a re-consent that names no keychain scope revokes (below). The schema cannot state this: \`scopes\` has minItems 1,
60
+ which stops only an empty list. The rule is enforced by the server against
61
+ the scope map, not by the schema. A scope string the scope map does not know
62
+ is refused with \`400\`, never silently dropped. Standard non-keychain scopes,
63
+ if the server accepts them at all (an open question), never count toward the
64
+ keychain-scope minimum. A token is never issued under a consent with an empty
65
+ keychain list, because a token limited to no keychains would hold no keys.
66
+ Re-consent changes the client's existing tokens, in the same transaction as
67
+ the consent update, by whether each token is scoped (\`keychainScoped\` true,
68
+ or a non-empty \`keychainIds\`). Every token matches exactly one branch:
69
+ - A scoped token gets \`keychainIds\` set to the
70
+ intersection of its keychains and the keychains of the new scopes. A
71
+ re-consent never adds keychains to a scoped token: a narrower re-consent
72
+ narrows it, and a broader one leaves it unchanged. A token whose
73
+ intersection is empty is revoked, not left with an empty list, because a
74
+ scoped token with no keychains holds no keys. This also holds when the token's
75
+ keychains were all deleted: its intersection is empty, so it is revoked,
76
+ and it never gains keys.
77
+ - An unrestricted token (\`keychainScoped\` false or absent and \`keychainIds\`
78
+ empty or absent) gets \`keychainIds\` set to
79
+ exactly the keychains of the new scopes, and \`keychainScoped\` set to true.
80
+ - A re-consent that names no keychain scope (only scopes
81
+ that map to no keychain) revokes: the consent is revoked (soft-deleted) and
82
+ every token issued to that client for that user is revoked, in the same
83
+ transaction. An unknown scope string is still refused with \`400\`.
84
+ A scope added by a re-consent takes effect only for tokens issued after that
85
+ consent, which is the user's fresh consent.
86
+ `,type:"object",additionalProperties:false,required:["id","clientId","clientName","scopes","organizationId","createdAt","updatedAt"],properties:{id:{description:"Server-generated consent ID.","x-go-name":"ID","x-oapi-codegen-extra-tags":{db:"id"},"x-order":1,type:"string",format:"uuid","x-go-type":"uuid.UUID","x-go-type-import":{path:"github.com/gofrs/uuid"}},clientId:{type:"string",description:"OAuth client ID the consent was granted to. An identifier issued by the authorization server, not a UUID. Unique per user among live consents.",minLength:1,maxLength:255,"x-id-format":"external","x-go-name":"ClientID","x-oapi-codegen-extra-tags":{db:"client_id"},"x-order":2},clientName:{type:"string",description:"Display name the client registered, shown to the user as the connected app's name.",minLength:1,maxLength:255,"x-oapi-codegen-extra-tags":{db:"client_name"},"x-order":3},clientUri:{type:"string",format:"uri",description:"Home page of the client, when it registered one. Omitted otherwise.",maxLength:2048,"x-oapi-codegen-extra-tags":{db:"client_uri",json:"clientUri,omitempty"},"x-order":4},logoUri:{type:"string",format:"uri",description:"Logo of the client, when it registered one. Omitted otherwise.",maxLength:2048,"x-oapi-codegen-extra-tags":{db:"logo_uri",json:"logoUri,omitempty"},"x-order":5},scopes:{type:"array",description:"Scopes the user granted the client, as the strings the authorization server issues. A scope names one keychain, so the client's tokens are limited to the keys of those keychains (see the token scoping contract). At least one scope must map to a keychain in the server's scope map. The server refuses (`400`, nothing stored) a first consent without one (a re-consent without one revokes the consent and the client's tokens), and refuses a scope string the scope map does not know; it never drops one silently. Standard non-keychain scopes never count toward that minimum. The schema enforces only that the list is not empty; the rule is enforced by the server against the scope map. See the description of this schema.",minItems:1,items:{type:"string",minLength:1,maxLength:255,pattern:"^\\S+$"},maxItems:100,uniqueItems:true,"x-go-type":"pq.StringArray","x-go-type-import":{path:"github.com/lib/pq"},"x-go-type-skip-optional-pointer":true,"x-oapi-codegen-extra-tags":{db:"scopes"},"x-order":6},organizationId:{description:"ID of the root organization the consent names. The client acts only in this organization and its descendants. A re-consent keeps it unless the user explicitly chooses another organization on the consent screen; see the description of this schema.","x-go-name":"OrganizationID","x-oapi-codegen-extra-tags":{db:"organization_id"},"x-order":7,type:"string",format:"uuid","x-go-type":"uuid.UUID","x-go-type-import":{path:"github.com/gofrs/uuid"}},createdAt:{description:"Time the user first granted the consent. A re-consent keeps it.",readOnly:true,"x-oapi-codegen-extra-tags":{db:"created_at"},"x-order":8,type:"string",format:"date-time","x-go-type-skip-optional-pointer":true},updatedAt:{description:"Time the consent was last granted or changed. Server-set: equal to `createdAt` when the consent is created, and advanced when the same user consents to the same live client again, which replaces `scopes`.",readOnly:true,"x-oapi-codegen-extra-tags":{db:"updated_at"},"x-order":9,type:"string",format:"date-time","x-go-type-skip-optional-pointer":true},lastUsedAt:{type:"string",format:"date-time",description:"Time the client last used a token issued under this consent. Null when the client has not used it yet or the server does not record use.",nullable:true,"x-go-type":"core.NullTime","x-go-type-import":{path:"github.com/meshery/schemas/models/core",name:"core"},"x-oapi-codegen-extra-tags":{db:"last_used_at",json:"lastUsedAt,omitempty"},"x-order":10},deletedAt:{description:"Time the consent was revoked (soft-deleted). Null while the consent is live. getOauthConsents returns live consents only.",nullable:true,"x-go-type":"core.NullTime","x-go-type-import":{name:"core",path:"github.com/meshery/schemas/models/core"},"x-oapi-codegen-extra-tags":{db:"deleted_at",json:"deletedAt,omitempty"},"x-order":11,type:"string",format:"date-time","x-go-type-skip-optional-pointer":true}}},description:"OAuth consents included on this page of results."}}}}}},400:{description:"Invalid request body or request param",content:{"text/plain":{schema:{type:"string"}}}},401:{description:"Expired JWT token used or insufficient privilege",content:{"text/plain":{schema:{type:"string"}}}},403:{description:"Forbidden",content:{"text/plain":{schema:{type:"string"}}}},500:{description:"Internal server error",content:{"text/plain":{schema:{type:"string"}}}}}},delete:{"x-internal":["cloud"],tags:["oauthConsents"],summary:"Revoke an OAuth consent",operationId:"deleteOauthConsent",description:`Revokes the signed-in user's consent for the client named by the
87
+ required \`clientId\` query parameter, and revokes every access and
88
+ refresh token that client holds for the user. The consents and tokens
89
+ of other users of the same client are untouched. Answers 204 with no
90
+ body. The consent is soft-deleted: its \`deletedAt\` is set and it is no
91
+ longer listed. For a session, and for a token naming its own client, a
92
+ client the user has no live consent for, whether it never existed, was
93
+ never consented to or was already revoked, is a 404.
94
+
95
+ Who may revoke depends on how the request is authenticated:
96
+ - A request authenticated by the person's signed-in session may revoke
97
+ any of that user's consents.
98
+ - A request authenticated by a token issued to an OAuth client may
99
+ revoke only the consent of the client the token was issued to. Naming
100
+ any other \`clientId\` answers 403 and changes nothing. The 403 does
101
+ not depend on whether that client has a live consent, so the answer
102
+ reveals nothing about another client.
103
+ - A personal API token, one not issued to an OAuth client, cannot revoke
104
+ a consent. Every such request answers 403 and changes nothing.
105
+ `,parameters:[{name:"clientId",in:"query",description:"OAuth client ID of the consent to revoke. An identifier issued by the authorization server, not a UUID.",required:true,schema:{type:"string",minLength:1,maxLength:255}}],responses:{204:{description:"OAuth consent revoked"},400:{description:"Invalid request body or request param",content:{"text/plain":{schema:{type:"string"}}}},401:{description:"Expired JWT token used or insufficient privilege",content:{"text/plain":{schema:{type:"string"}}}},403:{description:"Forbidden",content:{"text/plain":{schema:{type:"string"}}}},404:{description:"Result not found",content:{"text/plain":{schema:{type:"string"}}}},500:{description:"Internal server error",content:{"text/plain":{schema:{type:"string"}}}}}}}},components:{securitySchemes:{jwt:{type:"http",scheme:"bearer",bearerFormat:"JWT"}},responses:{400:{description:"Invalid request body or request param",content:{"text/plain":{schema:{type:"string"}}}},401:{description:"Expired JWT token used or insufficient privilege",content:{"text/plain":{schema:{type:"string"}}}},403:{description:"Forbidden",content:{"text/plain":{schema:{type:"string"}}}},404:{description:"Result not found",content:{"text/plain":{schema:{type:"string"}}}},500:{description:"Internal server error",content:{"text/plain":{schema:{type:"string"}}}}},parameters:{page:{name:"page",in:"query",description:"Get responses by page",schema:{type:"integer",minimum:0}},oauthConsentPageSize:{name:"pageSize",in:"query",description:"Number of consents per page, at most 1000. Bounded here because the list is the signed-in user's whole consent set.",schema:{type:"integer",minimum:1,maximum:1e3}},clientId:{name:"clientId",in:"query",description:"OAuth client ID of the consent to revoke. An identifier issued by the authorization server, not a UUID.",required:true,schema:{type:"string",minLength:1,maxLength:255}}},schemas:{OauthConsent:{$schema:"http://json-schema.org/draft-07/schema#",title:"OAuth Consent Schema",description:`Server-returned OAuth consent: one OAuth client (a connected app) the
106
+ signed-in user has allowed to act on their behalf, with what it was granted.
107
+ Unique key: (user, \`clientId\`) among live consents (\`deletedAt\` null). A
108
+ user has at most one live consent per client, so \`clientId\` identifies the
109
+ consent among the user's own; \`id\` is the stored row's ID. The consent
110
+ names one root organization; the client acts only in that organization and
111
+ its descendants. Created by the authorization server's consent step and
112
+ soft-deleted by revoking it; there is no write payload. A re-consent by the
113
+ same user to a client with a live consent updates that consent in place:
114
+ its scopes are replaced and \`updatedAt\` advances, while \`id\` and
115
+ \`createdAt\` are kept.
116
+ A re-consent keeps the consent's \`organizationId\`. The consent moves to
117
+ another organization only when the user explicitly chooses that organization
118
+ on the consent screen. Then every existing token issued to that client for
119
+ that user is revoked in the same transaction, whatever its keychains, and this
120
+ overrides the token rules below. Tokens are never re-bound to a new
121
+ organization silently: the client gets a token for the new organization only
122
+ under the consent that names it.
123
+ A consent must name a keychain scope. The server refuses a first consent
124
+ in which no scope maps to a keychain in its scope map, with \`400\` and nothing
125
+ stored; a re-consent that names no keychain scope revokes (below). The schema cannot state this: \`scopes\` has minItems 1,
126
+ which stops only an empty list. The rule is enforced by the server against
127
+ the scope map, not by the schema. A scope string the scope map does not know
128
+ is refused with \`400\`, never silently dropped. Standard non-keychain scopes,
129
+ if the server accepts them at all (an open question), never count toward the
130
+ keychain-scope minimum. A token is never issued under a consent with an empty
131
+ keychain list, because a token limited to no keychains would hold no keys.
132
+ Re-consent changes the client's existing tokens, in the same transaction as
133
+ the consent update, by whether each token is scoped (\`keychainScoped\` true,
134
+ or a non-empty \`keychainIds\`). Every token matches exactly one branch:
135
+ - A scoped token gets \`keychainIds\` set to the
136
+ intersection of its keychains and the keychains of the new scopes. A
137
+ re-consent never adds keychains to a scoped token: a narrower re-consent
138
+ narrows it, and a broader one leaves it unchanged. A token whose
139
+ intersection is empty is revoked, not left with an empty list, because a
140
+ scoped token with no keychains holds no keys. This also holds when the token's
141
+ keychains were all deleted: its intersection is empty, so it is revoked,
142
+ and it never gains keys.
143
+ - An unrestricted token (\`keychainScoped\` false or absent and \`keychainIds\`
144
+ empty or absent) gets \`keychainIds\` set to
145
+ exactly the keychains of the new scopes, and \`keychainScoped\` set to true.
146
+ - A re-consent that names no keychain scope (only scopes
147
+ that map to no keychain) revokes: the consent is revoked (soft-deleted) and
148
+ every token issued to that client for that user is revoked, in the same
149
+ transaction. An unknown scope string is still refused with \`400\`.
150
+ A scope added by a re-consent takes effect only for tokens issued after that
151
+ consent, which is the user's fresh consent.
152
+ `,type:"object",additionalProperties:false,required:["id","clientId","clientName","scopes","organizationId","createdAt","updatedAt"],properties:{id:{description:"Server-generated consent ID.","x-go-name":"ID","x-oapi-codegen-extra-tags":{db:"id"},"x-order":1,type:"string",format:"uuid","x-go-type":"uuid.UUID","x-go-type-import":{path:"github.com/gofrs/uuid"}},clientId:{type:"string",description:"OAuth client ID the consent was granted to. An identifier issued by the authorization server, not a UUID. Unique per user among live consents.",minLength:1,maxLength:255,"x-id-format":"external","x-go-name":"ClientID","x-oapi-codegen-extra-tags":{db:"client_id"},"x-order":2},clientName:{type:"string",description:"Display name the client registered, shown to the user as the connected app's name.",minLength:1,maxLength:255,"x-oapi-codegen-extra-tags":{db:"client_name"},"x-order":3},clientUri:{type:"string",format:"uri",description:"Home page of the client, when it registered one. Omitted otherwise.",maxLength:2048,"x-oapi-codegen-extra-tags":{db:"client_uri",json:"clientUri,omitempty"},"x-order":4},logoUri:{type:"string",format:"uri",description:"Logo of the client, when it registered one. Omitted otherwise.",maxLength:2048,"x-oapi-codegen-extra-tags":{db:"logo_uri",json:"logoUri,omitempty"},"x-order":5},scopes:{type:"array",description:"Scopes the user granted the client, as the strings the authorization server issues. A scope names one keychain, so the client's tokens are limited to the keys of those keychains (see the token scoping contract). At least one scope must map to a keychain in the server's scope map. The server refuses (`400`, nothing stored) a first consent without one (a re-consent without one revokes the consent and the client's tokens), and refuses a scope string the scope map does not know; it never drops one silently. Standard non-keychain scopes never count toward that minimum. The schema enforces only that the list is not empty; the rule is enforced by the server against the scope map. See the description of this schema.",minItems:1,items:{type:"string",minLength:1,maxLength:255,pattern:"^\\S+$"},maxItems:100,uniqueItems:true,"x-go-type":"pq.StringArray","x-go-type-import":{path:"github.com/lib/pq"},"x-go-type-skip-optional-pointer":true,"x-oapi-codegen-extra-tags":{db:"scopes"},"x-order":6},organizationId:{description:"ID of the root organization the consent names. The client acts only in this organization and its descendants. A re-consent keeps it unless the user explicitly chooses another organization on the consent screen; see the description of this schema.","x-go-name":"OrganizationID","x-oapi-codegen-extra-tags":{db:"organization_id"},"x-order":7,type:"string",format:"uuid","x-go-type":"uuid.UUID","x-go-type-import":{path:"github.com/gofrs/uuid"}},createdAt:{description:"Time the user first granted the consent. A re-consent keeps it.",readOnly:true,"x-oapi-codegen-extra-tags":{db:"created_at"},"x-order":8,type:"string",format:"date-time","x-go-type-skip-optional-pointer":true},updatedAt:{description:"Time the consent was last granted or changed. Server-set: equal to `createdAt` when the consent is created, and advanced when the same user consents to the same live client again, which replaces `scopes`.",readOnly:true,"x-oapi-codegen-extra-tags":{db:"updated_at"},"x-order":9,type:"string",format:"date-time","x-go-type-skip-optional-pointer":true},lastUsedAt:{type:"string",format:"date-time",description:"Time the client last used a token issued under this consent. Null when the client has not used it yet or the server does not record use.",nullable:true,"x-go-type":"core.NullTime","x-go-type-import":{path:"github.com/meshery/schemas/models/core",name:"core"},"x-oapi-codegen-extra-tags":{db:"last_used_at",json:"lastUsedAt,omitempty"},"x-order":10},deletedAt:{description:"Time the consent was revoked (soft-deleted). Null while the consent is live. getOauthConsents returns live consents only.",nullable:true,"x-go-type":"core.NullTime","x-go-type-import":{name:"core",path:"github.com/meshery/schemas/models/core"},"x-oapi-codegen-extra-tags":{db:"deleted_at",json:"deletedAt,omitempty"},"x-order":11,type:"string",format:"date-time","x-go-type-skip-optional-pointer":true}}},OauthConsentPage:{type:"object",description:"Paginated collection of the signed-in user's live OAuth consents.",required:["page","pageSize","totalCount","oauthConsents"],properties:{page:{type:"integer",description:"Current page number of the result set.",minimum:0},pageSize:{type:"integer",description:"Number of items per page.",minimum:1},totalCount:{type:"integer",description:"Total number of items available.",minimum:0},oauthConsents:{type:"array",items:{"x-go-type":"OauthConsent",$schema:"http://json-schema.org/draft-07/schema#",title:"OAuth Consent Schema",description:`Server-returned OAuth consent: one OAuth client (a connected app) the
153
+ signed-in user has allowed to act on their behalf, with what it was granted.
154
+ Unique key: (user, \`clientId\`) among live consents (\`deletedAt\` null). A
155
+ user has at most one live consent per client, so \`clientId\` identifies the
156
+ consent among the user's own; \`id\` is the stored row's ID. The consent
157
+ names one root organization; the client acts only in that organization and
158
+ its descendants. Created by the authorization server's consent step and
159
+ soft-deleted by revoking it; there is no write payload. A re-consent by the
160
+ same user to a client with a live consent updates that consent in place:
161
+ its scopes are replaced and \`updatedAt\` advances, while \`id\` and
162
+ \`createdAt\` are kept.
163
+ A re-consent keeps the consent's \`organizationId\`. The consent moves to
164
+ another organization only when the user explicitly chooses that organization
165
+ on the consent screen. Then every existing token issued to that client for
166
+ that user is revoked in the same transaction, whatever its keychains, and this
167
+ overrides the token rules below. Tokens are never re-bound to a new
168
+ organization silently: the client gets a token for the new organization only
169
+ under the consent that names it.
170
+ A consent must name a keychain scope. The server refuses a first consent
171
+ in which no scope maps to a keychain in its scope map, with \`400\` and nothing
172
+ stored; a re-consent that names no keychain scope revokes (below). The schema cannot state this: \`scopes\` has minItems 1,
173
+ which stops only an empty list. The rule is enforced by the server against
174
+ the scope map, not by the schema. A scope string the scope map does not know
175
+ is refused with \`400\`, never silently dropped. Standard non-keychain scopes,
176
+ if the server accepts them at all (an open question), never count toward the
177
+ keychain-scope minimum. A token is never issued under a consent with an empty
178
+ keychain list, because a token limited to no keychains would hold no keys.
179
+ Re-consent changes the client's existing tokens, in the same transaction as
180
+ the consent update, by whether each token is scoped (\`keychainScoped\` true,
181
+ or a non-empty \`keychainIds\`). Every token matches exactly one branch:
182
+ - A scoped token gets \`keychainIds\` set to the
183
+ intersection of its keychains and the keychains of the new scopes. A
184
+ re-consent never adds keychains to a scoped token: a narrower re-consent
185
+ narrows it, and a broader one leaves it unchanged. A token whose
186
+ intersection is empty is revoked, not left with an empty list, because a
187
+ scoped token with no keychains holds no keys. This also holds when the token's
188
+ keychains were all deleted: its intersection is empty, so it is revoked,
189
+ and it never gains keys.
190
+ - An unrestricted token (\`keychainScoped\` false or absent and \`keychainIds\`
191
+ empty or absent) gets \`keychainIds\` set to
192
+ exactly the keychains of the new scopes, and \`keychainScoped\` set to true.
193
+ - A re-consent that names no keychain scope (only scopes
194
+ that map to no keychain) revokes: the consent is revoked (soft-deleted) and
195
+ every token issued to that client for that user is revoked, in the same
196
+ transaction. An unknown scope string is still refused with \`400\`.
197
+ A scope added by a re-consent takes effect only for tokens issued after that
198
+ consent, which is the user's fresh consent.
199
+ `,type:"object",additionalProperties:false,required:["id","clientId","clientName","scopes","organizationId","createdAt","updatedAt"],properties:{id:{description:"Server-generated consent ID.","x-go-name":"ID","x-oapi-codegen-extra-tags":{db:"id"},"x-order":1,type:"string",format:"uuid","x-go-type":"uuid.UUID","x-go-type-import":{path:"github.com/gofrs/uuid"}},clientId:{type:"string",description:"OAuth client ID the consent was granted to. An identifier issued by the authorization server, not a UUID. Unique per user among live consents.",minLength:1,maxLength:255,"x-id-format":"external","x-go-name":"ClientID","x-oapi-codegen-extra-tags":{db:"client_id"},"x-order":2},clientName:{type:"string",description:"Display name the client registered, shown to the user as the connected app's name.",minLength:1,maxLength:255,"x-oapi-codegen-extra-tags":{db:"client_name"},"x-order":3},clientUri:{type:"string",format:"uri",description:"Home page of the client, when it registered one. Omitted otherwise.",maxLength:2048,"x-oapi-codegen-extra-tags":{db:"client_uri",json:"clientUri,omitempty"},"x-order":4},logoUri:{type:"string",format:"uri",description:"Logo of the client, when it registered one. Omitted otherwise.",maxLength:2048,"x-oapi-codegen-extra-tags":{db:"logo_uri",json:"logoUri,omitempty"},"x-order":5},scopes:{type:"array",description:"Scopes the user granted the client, as the strings the authorization server issues. A scope names one keychain, so the client's tokens are limited to the keys of those keychains (see the token scoping contract). At least one scope must map to a keychain in the server's scope map. The server refuses (`400`, nothing stored) a first consent without one (a re-consent without one revokes the consent and the client's tokens), and refuses a scope string the scope map does not know; it never drops one silently. Standard non-keychain scopes never count toward that minimum. The schema enforces only that the list is not empty; the rule is enforced by the server against the scope map. See the description of this schema.",minItems:1,items:{type:"string",minLength:1,maxLength:255,pattern:"^\\S+$"},maxItems:100,uniqueItems:true,"x-go-type":"pq.StringArray","x-go-type-import":{path:"github.com/lib/pq"},"x-go-type-skip-optional-pointer":true,"x-oapi-codegen-extra-tags":{db:"scopes"},"x-order":6},organizationId:{description:"ID of the root organization the consent names. The client acts only in this organization and its descendants. A re-consent keeps it unless the user explicitly chooses another organization on the consent screen; see the description of this schema.","x-go-name":"OrganizationID","x-oapi-codegen-extra-tags":{db:"organization_id"},"x-order":7,type:"string",format:"uuid","x-go-type":"uuid.UUID","x-go-type-import":{path:"github.com/gofrs/uuid"}},createdAt:{description:"Time the user first granted the consent. A re-consent keeps it.",readOnly:true,"x-oapi-codegen-extra-tags":{db:"created_at"},"x-order":8,type:"string",format:"date-time","x-go-type-skip-optional-pointer":true},updatedAt:{description:"Time the consent was last granted or changed. Server-set: equal to `createdAt` when the consent is created, and advanced when the same user consents to the same live client again, which replaces `scopes`.",readOnly:true,"x-oapi-codegen-extra-tags":{db:"updated_at"},"x-order":9,type:"string",format:"date-time","x-go-type-skip-optional-pointer":true},lastUsedAt:{type:"string",format:"date-time",description:"Time the client last used a token issued under this consent. Null when the client has not used it yet or the server does not record use.",nullable:true,"x-go-type":"core.NullTime","x-go-type-import":{path:"github.com/meshery/schemas/models/core",name:"core"},"x-oapi-codegen-extra-tags":{db:"last_used_at",json:"lastUsedAt,omitempty"},"x-order":10},deletedAt:{description:"Time the consent was revoked (soft-deleted). Null while the consent is live. getOauthConsents returns live consents only.",nullable:true,"x-go-type":"core.NullTime","x-go-type-import":{name:"core",path:"github.com/meshery/schemas/models/core"},"x-oapi-codegen-extra-tags":{db:"deleted_at",json:"deletedAt,omitempty"},"x-order":11,type:"string",format:"date-time","x-go-type-skip-optional-pointer":true}}},description:"OAuth consents included on this page of results."}}}}}},t=e;export{t as default};