This document formally defines the token scope specification for Sourcegraph Accounts Management System (SAMS) :
These scopes are used for user access tokens, as well as SAMS Machine-to-machine (M2M) Authentication and Authorization.
A scope is always consists of three parts: service, permission hierarchy, and action, and are separated by double colons ::
, e.g. sams::user.roles::read
, ssc::subscriptions::read
:
[a-z_]
characters, e.g. sams
, ssc
, dotcom
, cody_gateway
.[a-z_.]
characters, e.g. user
, user.metadata
, user.roles
.user
grants user.roles
, user.metadata
, etc.user.metadata
grants user.metadata.cody
, user.metadata.dotcom
, etc.<service>::user.profile::write
, the client is able to write to ALL aspects of the user profile. If a service wants to only allow access to a specific section, the service will need to create more specialized scopes. e.g. granting both <service>:user.profile.avatar_url::write
and <service>::user.profile.display_name::write
.read
: allowed to read resources from the servicewrite
: allowed to create or make updates to the resources of the servicedelete
: allowed to delete resources on the service(permission, action)
must be granted explicitly, there is no action hierarchy, e.g. having write permission doesn’t automatically grant read permission.This is initially intended for making OIDC scopes be compatible with our design (profile
-> sams::user.profile::read
), but could also be a useful extension in the future, e.g. in the event of scope renaming efforts.