Add identity-scoped OAuth token management
Let users create, list, and revoke manual bearer tokens from /me/oauth-tokens, scoped to their identity rather than an organization. Manual tokens store a null client_id and are authorized with a self-manage IAM policy. Wire Connect GraphQL on Identity (list, create, revoke), add console UI with scoped create flow and credentials dialog, and cover the flow in e2e tests. Fix list pagination ordering and keep the Relay connection in sync after create. Signed-off-by: Ludovic Vielle <ludovic@probo.com>
This commit is contained in:
@@ -42,6 +42,7 @@ var IAMSelfManageIdentityPolicy = policy.NewPolicy(
|
||||
ActionInvitationList,
|
||||
ActionSessionList,
|
||||
ActionPersonalAPIKeyList,
|
||||
ActionOAuth2AccessTokenList,
|
||||
).
|
||||
WithSID("list-own-associations").
|
||||
When(policy.Equals("principal.id", "resource.identity_id")),
|
||||
@@ -123,6 +124,21 @@ var IAMSelfManagePersonalAPIKeyPolicy = policy.NewPolicy(
|
||||
).
|
||||
WithDescription("Allows users to manage their own personal API keys")
|
||||
|
||||
// IAMSelfManageOAuth2AccessTokenPolicy allows users to manage their own OAuth2 access tokens.
|
||||
var IAMSelfManageOAuth2AccessTokenPolicy = policy.NewPolicy(
|
||||
"iam:self-manage-oauth2-access-token",
|
||||
"Self-Manage OAuth2 Access Tokens",
|
||||
|
||||
policy.Allow(
|
||||
ActionOAuth2AccessTokenCreate,
|
||||
ActionOAuth2AccessTokenGet,
|
||||
ActionOAuth2AccessTokenDelete,
|
||||
).
|
||||
WithSID("manage-own-oauth2-access-tokens").
|
||||
When(policy.Equals("principal.id", "resource.identity_id")),
|
||||
).
|
||||
WithDescription("Allows users to manage their own manually created OAuth2 access tokens")
|
||||
|
||||
// IAMSelfManageOAuth2ConsentPolicy allows users to manage their own OAuth2 consents.
|
||||
var IAMSelfManageOAuth2ConsentPolicy = policy.NewPolicy(
|
||||
"iam:self-manage-oauth2-consent",
|
||||
|
||||
Reference in New Issue
Block a user