github.com/pachyderm/pachyderm@v1.13.4/src/client/admin/v1_7/auth/auth.proto (about)

     1  syntax = "proto3";
     2  
     3  package auth_1_7;
     4  option go_package = "github.com/pachyderm/pachyderm/src/client/admin/v1_7/auth";
     5  
     6  import "gogoproto/gogo.proto";
     7  import "google/protobuf/timestamp.proto";
     8  
     9  /* A note on users
    10   *
    11   * Internally, in Pachyderm, usernames are structured strings. This makes both
    12   * our API and our data model more flexible (at the loss of some type safety).
    13   * Basically, anywhere that Pachyderm internally stores a subject (i.e.
    14   * TokenInfo) or principal (ACL, the 'admins' collection), that username will
    15   * have some structured prefix.
    16   *
    17   * Note that externally-facing principals ({Get,Set}{Scope,ACL}, ModifyAdmins,
    18   * ListAdmins) will have their own conventions
    19   *
    20   * The current user formats are:
    21   * 1) GitHub usernames:
    22   *      "github:MyGitHubUsername"
    23   * 2) Pachyderm robot users:
    24   *      "robot:robot_user_1"
    25   * 3) Pachyderm pipelines:
    26   *      "pipeline:terasort"
    27   */
    28  
    29  
    30  //// Activation API
    31  
    32  // ActivateRequest mirrors AuthenticateRequest. The caller is authenticated via
    33  // GitHub OAuth, and then promoted to the cluster's first Admin. Afterwards, the
    34  // caller can promote other users to Admin and remove themselves
    35  message ActivateRequest {
    36    // If set, Pachyderm will authenticate the caller as this user.
    37    // - If set to a github user (i.e. it has a 'github:' prefix or no prefix)
    38    //   then Pachyderm will confirm that it matches the user associated with
    39    //   'github_token'
    40    // - If set to a robot user (i.e. it has a 'robot:' prefix), then Pachyderm
    41    //   will generate a new token for the robot user; this token will be the only
    42    //   way to administer this cluster until more admins are added.
    43    string subject = 2;
    44  
    45    // This is the token returned by GitHub and used to authenticate the caller.
    46    // When Pachyderm is deployed locally, setting this value to a given string
    47    // will automatically authenticate the caller as a GitHub user whose username
    48    // is that string (unless this "looks like" a GitHub access code, in which
    49    // case Pachyderm does retrieve the corresponding GitHub username)
    50    string github_token = 1 [(gogoproto.customname) = "GitHubToken"];
    51  }
    52  
    53  message ActivateResponse {
    54    // pach_token authenticates the caller with Pachyderm (if you want to perform
    55    // Pachyderm operations after auth has been activated as themselves, you must
    56    // present this token along with your regular request)
    57    string pach_token = 1;
    58  }
    59  
    60  message DeactivateRequest {}
    61  message DeactivateResponse {}
    62  
    63  // IDProvider configures a single ID provider that can authenticate Pachyderm
    64  // users
    65  message IDProvider {
    66    // Name identifies this authentication backend in Pachyderm.
    67    string name = 1;
    68  
    69    // Description is a human-readable description of this authentication
    70    // backend. It's ignored by Pachyderm, but exists for the benefit of users
    71    // configuring Pachyderm's auth system.
    72    string description = 2;
    73  
    74    // SAMLOptions describes a SAML-based identity provider
    75    message SAMLOptions {
    76      // metadata_url is the URL of the SAML ID provider's metadata service
    77      // (which Pachd can query to get more info about the SAML ID provider)
    78      string metadata_url = 1 [(gogoproto.customname) = "MetadataURL"];
    79  
    80      // metadata_xml is a direct reproduction of the ID provider's metadata.
    81      // Users can set this field in the argument to SetConfig if the ID provider
    82      // can't be reached from pachd (e.g. because it's on a separate network to
    83      // which Pachyderm users also have access) or for testing.  Exactly one of
    84      // metadata_url and metadata_xml should be set in calls to SetConfig, but
    85      // internally, if metadata_url is set, the result of scraping the metadata
    86      // URL will be placed here in the result from GetConfig().
    87      bytes metadata_xml = 2 [(gogoproto.customname) = "MetadataXML"];
    88  
    89      // If this ID provider supports sending group memberships via attribute,
    90      // then users can set group_attribute to the SAML attribute that indicates
    91      // group mmbership, and Pachyderm will update users' group memberships when
    92      // they authenticate.
    93      string group_attribute = 3;
    94    }
    95    SAMLOptions saml = 3 [(gogoproto.customname) = "SAML"];
    96  }
    97  
    98  // Configure Pachyderm's auth system (particularly authentication backends
    99  message AuthConfig {
   100    // live_config_version identifies the version of a given pachyderm cluster's
   101    // current auth configuration; if a user tries to write an auth configuration
   102    // where live_config_version doesn't match the version of the cluster's
   103    // current config, the write will fail. This allows for safe
   104    // read+modify+write config changes.
   105    int64 live_config_version = 1;
   106  
   107    // id_providers describes external ID providers that can authenticate
   108    // Pachyderm users (e.g. GitHub, Okta, etc)
   109    repeated IDProvider id_providers = 2 [(gogoproto.customname) = "IDProviders"];
   110  
   111    // saml_svc_options configures the SAML services (Assertion Consumer Service
   112    // and Metadata Service) that Pachd can export.
   113    message SAMLServiceOptions {
   114      // acs is the URL of Pachd's Assertion Consumer Service (i.e. where SAML ID
   115      // providers can send SAMLResponses to Pachd). If Pachyderm is running in a
   116      // private cluster, the cluster admin would be responsible for setting up a
   117      // domain name/proxy to resolve to pachd:654/acs
   118      string acs_url = 1 [(gogoproto.customname) = "ACSURL"];
   119  
   120      // metadata_url is the public URL of Pachd's SAML metadata service (some
   121      // SAML ID providers will query this for information about Pachyderm's SAML
   122      // implementation and use it to idenfity Pachyderm as a service provider).
   123      // If Pachyderm is running in a private cluster, the cluster admin would be
   124      // responsible for creating this URL (which must resolve to
   125      // pachd:654/saml/metadata)
   126      string metadata_url = 2 [(gogoproto.customname) = "MetadataURL"];
   127  
   128      // dash_url is the public address of this cluster's Pachyderm
   129      // dashboard, if one exists; this option determines where users will be
   130      // redirected after successfully authenticating
   131      string dash_url = 3 [(gogoproto.customname) = "DashURL"];
   132  
   133      // session_duration determines the duration of SAML-IdP-authenticated user
   134      // sessions (specified as a Golang time duration, e.g. "24h" or "600m"). If
   135      // unset, user sessions last 24 hours (a short default, as SAML assertions
   136      // may contain group memberships that need to be refreshed)
   137      string session_duration = 4;
   138  
   139      // debug_logging determines whether pachd emits verbose logs (including
   140      // SAML credentials) as it receives them, which may be helpful for
   141      // debugging. This will probably not be present in any official releases.
   142      bool debug_logging = 5;
   143    }
   144    SAMLServiceOptions saml_svc_options = 3 [(gogoproto.customname) = "SAMLServiceOptions"];
   145  }
   146  
   147  message GetConfigurationRequest {}
   148  message GetConfigurationResponse {
   149    AuthConfig configuration = 1;
   150  }
   151  message SetConfigurationRequest {
   152    AuthConfig configuration = 1;
   153  }
   154  message SetConfigurationResponse {}
   155  
   156  // Get the current list of cluster admins
   157  message GetAdminsRequest{}
   158  message GetAdminsResponse{
   159    // admins contains the list of cluster admins
   160    repeated string admins = 1;
   161  }
   162  
   163  // Add or remove cluster admins
   164  message ModifyAdminsRequest {
   165    repeated string add = 1;
   166    repeated string remove = 2;
   167  }
   168  message ModifyAdminsResponse {}
   169  
   170  //// Authentication data structures
   171  
   172  // OTPInfo is the analogue of 'TokenInfo' for Authentication Codes (short-lived,
   173  // one-time-use codes that are passed to the frontend and then exchanged for
   174  // longer-lived tokens)
   175  message OTPInfo {
   176    // Subject (i.e. Pachyderm account) that a given OTP authenticates. This may
   177    // be copied into the 'subject' field of a TokenInfo, and therefore has the
   178    // same format, with the same prefixes.
   179    string subject = 1;
   180  
   181    // session_expiration indicates when the subject's session expires, a.k.a.
   182    // when the Token to which this OTP converts expires (likely later than this
   183    // OTP expires, but never earlier).
   184    google.protobuf.Timestamp session_expiration = 2;
   185  }
   186  
   187  // TokenInfo is the 'value' of an auth token 'key' in the 'tokens' collection
   188  message TokenInfo {
   189    // Subject (i.e. Pachyderm account) that a given token authorizes. Prefixed
   190    // with "github:" or "robot:" to distinguish the two classes of
   191    // Subject in Pachyderm
   192    string subject = 1;
   193  
   194    enum TokenSource {
   195      INVALID = 0;
   196      AUTHENTICATE = 1; // returned by Authenticate()--non-revokeable
   197      GET_TOKEN = 2;  // returned by GetToken()--revokeable.
   198    }
   199    TokenSource source = 2;
   200  }
   201  
   202  //// Authentication API
   203  
   204  message AuthenticateRequest {
   205    // Exactly one of 'github_token' or 'one_time_password' must be set:
   206  
   207    // This is the token returned by GitHub and used to authenticate the caller.
   208    // When Pachyderm is deployed locally, setting this value to a given string
   209    // will automatically authenticate the caller as a GitHub user whose username
   210    // is that string (unless this "looks like" a GitHub access code, in which
   211    // case Pachyderm does retrieve the corresponding GitHub username)
   212    string github_token = 1 [(gogoproto.customname) = "GitHubToken"];
   213  
   214    // This is a short-lived, one-time-use password generated by Pachyderm, for
   215    // the purpose of propagating authentication to new clients (e.g. from the
   216    // dash to pachd)
   217    string one_time_password = 2;
   218  }
   219  
   220  message AuthenticateResponse {
   221    // pach_token authenticates the caller with Pachyderm (if you want to perform
   222    // Pachyderm operations after auth has been activated as themselves, you must
   223    // present this token along with your regular request)
   224    string pach_token = 1;
   225  }
   226  
   227  message WhoAmIRequest {}
   228  
   229  message WhoAmIResponse {
   230    string username = 1;
   231    bool is_admin = 2;
   232    int64 ttl = 3 [(gogoproto.customname) = "TTL"];
   233  }
   234  
   235  //// Authorization data structures
   236  
   237  // Scope (actually a "role" in canonical security nomenclature) represents a
   238  // rough level of access that a principal has to a repo
   239  enum Scope {
   240    // To remove a user's scope from a repo, set their scope to NONE
   241    NONE = 0;
   242    READER = 1;
   243    WRITER = 2;
   244    OWNER = 3;
   245  }
   246  
   247  message ACL {
   248    // principal -> scope. All principals are the default principal of a Pachyderm
   249    // subject (i.e. all keys in this map are strings prefixed with either
   250    // "github:" or "robot:", followed by the name of a GitHub user, all of whom
   251    // are Pachyderm subjects, or a Pachyderm robot user)
   252    map<string, Scope> entries = 1;
   253  }
   254  
   255  message Users {
   256    map<string, bool> usernames = 1;
   257  }
   258  
   259  message Groups {
   260    map<string, bool> groups = 1;
   261  }
   262  
   263  //// Authorization API
   264  
   265  message AuthorizeRequest {
   266    // repo is the object that the caller wants to access
   267    string repo = 1;
   268  
   269    // scope is the access level that the caller needs to perform an action
   270    Scope scope = 2;
   271  }
   272  
   273  message AuthorizeResponse {
   274    // authorized is true if the caller has at least
   275    // 'AuthorizeRequest.scope'-level access to 'AuthorizeRequest.repo', and false
   276    // otherwise
   277    bool authorized = 1;
   278  }
   279  
   280  message GetScopeRequest {
   281    // username is the principal (some of which belong to robots rather than
   282    // users, but the name is preserved for now to provide compatibility with the
   283    // pachyderm dash) whose access level is queried. To query the access level
   284    // of a robot user, the caller must prefix username with "robot:". If
   285    // 'username' has no prefix (i.e. no ":"), then it's assumed to be a github
   286    // user's principal.
   287    string username = 1;
   288  
   289    // repos are the objects to which 'username's access level is being queried
   290    repeated string repos = 2;
   291  }
   292  
   293  message GetScopeResponse {
   294    // scopes (actually a "role"--see "Scope") are the access level that
   295    // 'GetScopeRequest.username' has to each repo in 'GetScopeRequest.repos', in
   296    // the same order that repos appeared in 'repos'.
   297    repeated Scope scopes = 1;
   298  }
   299  
   300  message SetScopeRequest {
   301    // username is the principal (some of which belong to robots rather than
   302    // users, but the name is preserved for now to provide compatibility with the
   303    // pachyderm dash) whose access is being granted/revoked. As with
   304    // GetScopeRequest, to set the access level of a robot user, the caller must
   305    // prefix username with "robot:". If 'username' has no prefix (i.e. no ":"),
   306    // then it's assumed to be a github user's principal.
   307    string username = 1;
   308  
   309    // repo is the object to which access is being granted/revoked
   310    string repo = 2;
   311  
   312    // scope (actually a "role"--see "Scope") is the access level that the owner
   313    // of 'principal' will now have
   314    Scope scope = 3;
   315  }
   316  
   317  message SetScopeResponse {}
   318  
   319  message GetACLRequest {
   320    string repo = 1;
   321  }
   322  
   323  message ACLEntry {
   324    // username is the principal posessing this level of access to this ACL's
   325    // repo (despite the name, this principal may be for a human github user or a
   326    // pachyderm robot)
   327    string username = 1;
   328  
   329    // scope is the level of access that the owner of 'principal' has to this
   330    // ACL's repo (actually a role in typical security terminology)
   331    Scope scope = 2;
   332  }
   333  
   334  // GetACLReponse contains the list of entries on a Pachyderm ACL.
   335  //
   336  // To avoid migration pain with the Pachyderm dash the list of user principal
   337  // entries and robot principal entries are separate. This way, no prefix or
   338  // other disambiguating device is needed in 'entries' to separate user
   339  // principals from robot principals (which would confuse the dash). Instead,
   340  // the dash can simply ignore robot principals.
   341  message GetACLResponse {
   342    // entries contains all [user principal] -> [role] mappings. This is separate
   343    // from robot_entries to avoid migration pain the Pachyderm dashboard
   344    repeated ACLEntry entries = 1;
   345  
   346    // robot_entries contains all [robot principal] -> [role] mappings. This is
   347    // separate from entries to be unambiguous (all keys are robot principals, but
   348    // have no prefixes) while avoiding migration pain in the Pachyderm dashboard.
   349    repeated ACLEntry robot_entries = 2;
   350  }
   351  
   352  message SetACLRequest {
   353    string repo = 1;
   354    repeated ACLEntry entries = 2;
   355  }
   356  
   357  message SetACLResponse {}
   358  
   359  //// Token API (very limited -- for pipelines)
   360  
   361  message GetAuthTokenRequest {
   362    // The returned token will allow the caller to access resources as this
   363    // subject
   364    string subject = 1;
   365  
   366    // ttl indicates the approximate remaining lifetime of this token, in seconds
   367    int64 ttl = 2 [(gogoproto.customname) = "TTL"];
   368  }
   369  
   370  message GetAuthTokenResponse {
   371    // A canonicalized version of the subject in the request
   372    string subject = 2;
   373  
   374    // A new auth token for the user in 'GetAuthTokenRequest.Subject' token
   375    string token = 1;
   376  }
   377  
   378  message ExtendAuthTokenRequest {
   379    // token indicates the Pachyderm token whose TTL is being extended
   380    string token = 1;
   381  
   382    // ttl indicates the new TTL of 'token' (if it's longer than the existing TTL)
   383    int64 ttl = 2 [(gogoproto.customname) = "TTL"];
   384  }
   385  
   386  message ExtendAuthTokenResponse {}
   387  
   388  message RevokeAuthTokenRequest {
   389    string token = 1;
   390  }
   391  
   392  message RevokeAuthTokenResponse {}
   393  
   394  message SetGroupsForUserRequest {
   395    string username = 1;
   396    repeated string groups = 2;
   397  }
   398  
   399  message SetGroupsForUserResponse {}
   400  
   401  message ModifyMembersRequest {
   402    string group = 1;
   403    repeated string add = 2;
   404    repeated string remove = 3;
   405  }
   406  
   407  message ModifyMembersResponse {}
   408  
   409  message GetGroupsRequest {
   410    string username = 1;
   411  }
   412  
   413  message GetGroupsResponse {
   414    repeated string groups = 1;
   415  }
   416  
   417  message GetUsersRequest {
   418    string group = 1;
   419  }
   420  
   421  message GetUsersResponse {
   422    repeated string usernames = 1;
   423  }
   424  
   425  // GetOneTimePassword allows users to generate short-lived (~30s) tokens that
   426  // can be passed to Authenticate() (via AuthenticateRequest.one_time_password)
   427  // and exchanged for a longer-lived pachyderm token. This is more secure than
   428  // GetAuthToken, which produces long-lived authorization tokens.
   429  message GetOneTimePasswordRequest {
   430    // If the caller is an admin, GetOneTimePassword() can return a code for
   431    // any user (useful for testing).
   432    // If the caller is not an admin, GetOneTimePassword() will return an
   433    // authentication code for the caller if username is unset or set to the
   434    // caller's username (and will return an error otherwise)
   435    string subject = 1;
   436  }
   437  
   438  message GetOneTimePasswordResponse {
   439    string code = 1;
   440  }
   441  
   442  service API {
   443    // Activate/Deactivate the auth API. 'Activate' sets an initial set of admins
   444    // for the Pachyderm cluster, and 'Deactivate' removes all ACLs, tokens, and
   445    // admins from the Pachyderm cluster, making all data publicly accessable
   446    rpc Activate(ActivateRequest) returns (ActivateResponse) {}
   447    rpc Deactivate(DeactivateRequest) returns (DeactivateResponse) {}
   448  
   449    rpc GetConfiguration(GetConfigurationRequest) returns (GetConfigurationResponse) {}
   450    rpc SetConfiguration(SetConfigurationRequest) returns (SetConfigurationResponse) {}
   451  
   452    // GetAdmins returns the current list of cluster admins
   453    rpc GetAdmins(GetAdminsRequest) returns (GetAdminsResponse) {}
   454    // ModifyAdmins adds or removes admins from the cluster
   455    rpc ModifyAdmins(ModifyAdminsRequest) returns (ModifyAdminsResponse) {}
   456  
   457    rpc Authenticate(AuthenticateRequest) returns (AuthenticateResponse) {}
   458    rpc Authorize(AuthorizeRequest) returns (AuthorizeResponse) {}
   459    rpc WhoAmI(WhoAmIRequest) returns (WhoAmIResponse) {}
   460  
   461    rpc GetScope(GetScopeRequest) returns (GetScopeResponse) {}
   462    rpc SetScope(SetScopeRequest) returns (SetScopeResponse) {}
   463    rpc GetACL(GetACLRequest) returns (GetACLResponse) {}
   464    rpc SetACL(SetACLRequest) returns (SetACLResponse) {}
   465  
   466    rpc GetAuthToken(GetAuthTokenRequest) returns (GetAuthTokenResponse) {}
   467    rpc ExtendAuthToken(ExtendAuthTokenRequest) returns (ExtendAuthTokenResponse) {}
   468    rpc RevokeAuthToken(RevokeAuthTokenRequest) returns (RevokeAuthTokenResponse) {}
   469  
   470    rpc SetGroupsForUser(SetGroupsForUserRequest) returns (SetGroupsForUserResponse) {}
   471    rpc ModifyMembers(ModifyMembersRequest) returns (ModifyMembersResponse) {}
   472    rpc GetGroups(GetGroupsRequest) returns (GetGroupsResponse) {}
   473    rpc GetUsers(GetUsersRequest) returns (GetUsersResponse) {}
   474  
   475    rpc GetOneTimePassword(GetOneTimePasswordRequest) returns (GetOneTimePasswordResponse) {}
   476  }