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