Skip to content
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

Add approle role name to metadata #2985

Merged
merged 1 commit into from
Jul 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions builtin/credential/approle/path_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ func (b *backend) pathLoginUpdate(req *logical.Request, data *framework.FieldDat
return logical.ErrorResponse(fmt.Sprintf("failed to validate SecretID: %s", err)), nil
}

// Always include the role name, for later filtering
metadata["role_name"] = roleName
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about doing this in path_role.go handleRoleSecretIDCommon when we are persisting the metadata? We might also want to mention in docs that if SecretID metadata is not supplied, by default we add an entry there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishalnayak one problem with that approach is that existing roles/secret IDs won't have that metadata value persisted unless they're rewritten, whereas this will always work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. That's true.


auth := &logical.Auth{
NumUses: role.TokenNumUses,
Period: role.Period,
Expand Down