mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 03:27:54 +00:00
core: handleLoginRequest should set resp.Auth.Orphan = true (#6335)
* core: handleLoginRequest should set resp.Auth.Orphan = true * set auth.Orphan in RegisterAuth dynamically * update related tests
This commit is contained in:
committed by
GitHub
parent
213da13264
commit
4858864a70
@@ -217,6 +217,7 @@ func TestLogical_CreateToken(t *testing.T) {
|
||||
"renewable": false,
|
||||
"entity_id": "",
|
||||
"token_type": "service",
|
||||
"orphan": false,
|
||||
},
|
||||
"warnings": nilWarnings,
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ func TestTokenStore_CreateOrphanResponse(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if secret.Auth.Orphan {
|
||||
t.Fatalf("failed to set orphan as true")
|
||||
if !secret.Auth.Orphan {
|
||||
t.Fatalf("failed to set orphan as true, got: %#v", secret.Auth)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1162,6 +1162,7 @@ func (c *Core) RegisterAuth(ctx context.Context, tokenTTL time.Duration, path st
|
||||
auth.ClientToken = te.ID
|
||||
auth.Accessor = te.Accessor
|
||||
auth.TTL = te.TTL
|
||||
auth.Orphan = te.Parent == ""
|
||||
|
||||
switch auth.TokenType {
|
||||
case logical.TokenTypeBatch:
|
||||
|
||||
Reference in New Issue
Block a user