mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-20 00:31:17 -08:00
* cmd/tsidp: add groups claim to tsidp
This feature adds support for a `groups` claim in tsidp using the grants
syntax:
```json
{
"grants": [
{
"src": ["group:admins"],
"dst": ["*"],
"ip": ["*"],
"app": {
"tailscale.com/cap/tsidp": [
{
"groups": ["admin"]
}
]
}
},
{
"src": ["group:reader"],
"dst": ["*"],
"ip": ["*"],
"app": {
"tailscale.com/cap/tsidp": [
{
"groups": ["reader"]
}
]
}
}
]
}
```
For #10263
Signed-off-by: Cedric Kienzler <[email protected]>
* cmd/tsidp: refactor cap/tsidp to allow extraClaims
This commit refactors the `capRule` struct to allow specifying arbitrary
extra claims:
```json
{
"src": ["group:reader"],
"dst": ["*"],
"ip": ["*"],
"app": {
"tailscale.com/cap/tsidp": [
{
"extraClaims": {
"groups": ["reader"],
"entitlements": ["read-stuff"],
},
}
]
}
}
```
Overwriting pre-existing claims cannot be modified/overwritten.
Also adding more unit-testing
Signed-off-by: Cedric Kienzler <[email protected]>
* Update cmd/tsidp/tsidp.go
Signed-off-by: cedi <[email protected]>
* Update cmd/tsidp/tsidp_test.go
Co-authored-by: Patrick O'Doherty <[email protected]>
Signed-off-by: Cedric Kienzler <[email protected]>
* Update cmd/tsidp/tsidp_test.go
Co-authored-by: Patrick O'Doherty <[email protected]>
Signed-off-by: Cedric Kienzler <[email protected]>
* Fix logical error in test case
Signed-off-by: Cedric Kienzler <[email protected]>
* fix error printing for failed to unmarshal capability in tsidp
Signed-off-by: Cedric Kienzler <[email protected]>
* clarify doc string for withExtraClaims
Signed-off-by: Cedric Kienzler <[email protected]>
---------
Signed-off-by: Cedric Kienzler <[email protected]>
Signed-off-by: cedi <[email protected]>
Signed-off-by: Cedric Kienzler <[email protected]>
Co-authored-by: Patrick O'Doherty <[email protected]>