go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/server/auth/realms/attrs.go (about) 1 // Copyright 2022 The LUCI Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package realms 16 17 // Attrs are the context of a particular permission check. 18 // 19 // Attributes specified here are used as inputs to `conditions` predicates in 20 // conditional bindings. If a service supports conditional bindings, it must 21 // document what attributes it passes with each permission it checks. 22 // 23 // For example, a service may document that when it checks permission 24 // "service.entity.create" it supplies an attribute with key 25 // "service.entity.name" and the value matching the name of the entity being 26 // created. 27 // 28 // One then can create a binding like: 29 // 30 // role: "role/service.entities.creator" 31 // principals: ["user:restricted-creator@example.com"] 32 // conditions: { 33 // restrict { 34 // attribute: "service.entity.name" 35 // values: ["name1", "name2"] 36 // } 37 // } 38 // 39 // That binding encodes that "user:restricted-creator@example.com" can create 40 // entities *only* if they are named "name1" or "name2". 41 type Attrs map[string]string