-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic Roles #897
Dynamic Roles #897
Conversation
30c38b9
to
ecbd113
Compare
ecbd113
to
fcfb883
Compare
lib/auth/auth.go
Outdated
} | ||
|
||
// figure out ttl for role. expires = now + ttl => ttl = expires - now | ||
ttl := ident.ExpiresAt.Sub(time.Now()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use auth server clock instead?
lib/auth/auth.go
Outdated
} else { | ||
} | ||
|
||
// check if any exisiting user is a non-oidc user, dont override their |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
incomplete comment sentence
// Roles is a list of static teleport roles to match. | ||
Roles []string `json:"roles,omitempty"` | ||
// RoleTemplate a template role that will be filled out with claims. | ||
RoleTemplate *RoleV2 `json:"role_template,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you implement this sligthly in a different way that will allow me to add extesions:
- use json.RawMessageHere
- use GetRoleMarshaller().Unmarshal()
- set the value
This will allow me to override this setting in Telekube and Teleport Enterprise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, nevermind, I can already do this without this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have a couple of comments around using time, otherwise looks good.
@klizhentas Made the changes you suggested, can you take another look? |
Purpose
As covered in #891, at the moment using OIDC with individual system logins means you have to either create a role for every user or keep updating a shared role with logins whenever someone new joins the team.
To improve the user experience of OIDC and Teleport, this PR allows you to define a role template that can be used to dynamically create roles based off the claims received from an identity provider.
Implementation
The
claims_to_roles
for an OIDC connector can now containroles
or arole_template
that contains an embedded role that is filled out by data from claims.UpsertRole
has been updated with a TTL so that dynamic roles are removed along with the dynamic user.User creation logic has been updated so if you re-login via OIDC you don't have to wait for your existing
User
to expire.Related Issues
Fixes #891