Skip to content

Commit 3a8f6ac

Browse files
jaireddjawedhashiblaumtvoran
authored
Vault 34298 backport auth group sourcing 1.18.x (#337)
* allow optional access token to be used to fetch additional groups (#329) * allow optional access token to be used to fetch additional groups * rename field * rename var * update description * Update path_login.go Co-authored-by: Theron Voran <[email protected]> --------- Co-authored-by: Theron Voran <[email protected]> * Revert "[Vault 1.18] update to go 1.23.8 and deps (#334)" This reverts commit a772140. * Reapply "[Vault 1.18] update to go 1.23.8 and deps (#334)" This reverts commit 1fb2172. --------- Co-authored-by: Michael Blaum <[email protected]> Co-authored-by: Theron Voran <[email protected]>
1 parent a772140 commit 3a8f6ac

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

path_login.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ func pathLogin(b *jwtAuthBackend) *framework.Path {
3434
Type: framework.TypeString,
3535
Description: "The signed JWT to validate.",
3636
},
37+
"distributed_claim_access_token": {
38+
Type: framework.TypeString,
39+
Description: "An optional token used to fetch group memberships specified by the distributed claim source in the jwt. This is supported only on Azure/Entra ID",
40+
},
3741
},
3842

3943
Operations: map[logical.Operation]framework.OperationHandler{
@@ -112,6 +116,8 @@ func (b *jwtAuthBackend) pathLogin(ctx context.Context, req *logical.Request, d
112116
return logical.ErrorResponse("missing token"), nil
113117
}
114118

119+
distClaimAccessToken := d.Get("distributed_claim_access_token").(string)
120+
115121
if len(role.TokenBoundCIDRs) > 0 {
116122
if req.Connection == nil {
117123
b.Logger().Warn("token bound CIDRs found but no connection information available for validation")
@@ -173,7 +179,7 @@ func (b *jwtAuthBackend) pathLogin(ctx context.Context, req *logical.Request, d
173179
}
174180
}
175181

176-
alias, groupAliases, err := b.createIdentity(ctx, allClaims, roleName, role, nil)
182+
alias, groupAliases, err := b.createIdentity(ctx, allClaims, roleName, role, &accessTokenSrc{accessToken: distClaimAccessToken})
177183
if err != nil {
178184
return logical.ErrorResponse(err.Error()), nil
179185
}
@@ -350,3 +356,15 @@ const (
350356
Authenticates JWTs.
351357
`
352358
)
359+
360+
type accessTokenSrc struct {
361+
accessToken string
362+
}
363+
364+
func (j *accessTokenSrc) Token() (*oauth2.Token, error) {
365+
return &oauth2.Token{
366+
AccessToken: j.accessToken,
367+
TokenType: "Bearer",
368+
}, nil
369+
370+
}

0 commit comments

Comments
 (0)