mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-11-04 04:28:08 +00:00 
			
		
		
		
	Return num_uses during authentication (#12791)
* Return num_uses during authentication https://github.com/hashicorp/vault/issues/10664 * Add changelog entry
This commit is contained in:
		
							
								
								
									
										3
									
								
								changelog/12791.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								changelog/12791.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					```release-notes:improvemment
 | 
				
			||||||
 | 
					core: `num_uses` is now returned during authentication
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
@@ -224,6 +224,7 @@ func TestLogical_CreateToken(t *testing.T) {
 | 
				
			|||||||
			"entity_id":      "",
 | 
								"entity_id":      "",
 | 
				
			||||||
			"token_type":     "service",
 | 
								"token_type":     "service",
 | 
				
			||||||
			"orphan":         false,
 | 
								"orphan":         false,
 | 
				
			||||||
 | 
								"num_uses":       json.Number("0"),
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		"warnings": nilWarnings,
 | 
							"warnings": nilWarnings,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,6 +39,7 @@ func LogicalResponseToHTTPResponse(input *Response) *HTTPResponse {
 | 
				
			|||||||
			EntityID:         input.Auth.EntityID,
 | 
								EntityID:         input.Auth.EntityID,
 | 
				
			||||||
			TokenType:        input.Auth.TokenType.String(),
 | 
								TokenType:        input.Auth.TokenType.String(),
 | 
				
			||||||
			Orphan:           input.Auth.Orphan,
 | 
								Orphan:           input.Auth.Orphan,
 | 
				
			||||||
 | 
								NumUses:          input.Auth.NumUses,
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -108,6 +109,7 @@ type HTTPAuth struct {
 | 
				
			|||||||
	EntityID         string            `json:"entity_id"`
 | 
						EntityID         string            `json:"entity_id"`
 | 
				
			||||||
	TokenType        string            `json:"token_type"`
 | 
						TokenType        string            `json:"token_type"`
 | 
				
			||||||
	Orphan           bool              `json:"orphan"`
 | 
						Orphan           bool              `json:"orphan"`
 | 
				
			||||||
 | 
						NumUses          int               `json:"num_uses"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type HTTPWrapInfo struct {
 | 
					type HTTPWrapInfo struct {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -158,7 +158,8 @@ $ curl \
 | 
				
			|||||||
    "renewable": true,
 | 
					    "renewable": true,
 | 
				
			||||||
    "entity_id": "",
 | 
					    "entity_id": "",
 | 
				
			||||||
    "token_type": "service",
 | 
					    "token_type": "service",
 | 
				
			||||||
    "orphan": false
 | 
					    "orphan": false,
 | 
				
			||||||
 | 
					    "num_uses": 0
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user