feat(yaiam): token exchange for a user's token at another service (RFC 8693)
Exchanger trades a user's access token, as a confidential client with its secret in a Basic header, for one at another yaiam client (yaiam ADR-0045): Exchange(ctx, subject, audience, scopes...) and Revoke for the end of an agent's job. Only access tokens are asked for and taken. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
76543b23a0
commit
560a1ead8a
4 files changed
+293
-1
No files matched your search
@@ -242,6 +242,12 @@ func (c *Client) post(ctx context.Context, name, endpoint string, form url.Value
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
req.Header.Set("Accept", "application/json")
|
||||
return c.send(name, req, out)
|
||||
}
|
||||
|
||||
// send sends req. A 200 answer is decoded into out (if not nil); any
|
||||
// other is returned as *Error.
|
||||
func (c *Client) send(name string, req *http.Request, out any) error {
|
||||
status, body, err := c.do(req)
|
||||
if err != nil {
|
||||
return fmt.Errorf("yaiam: %s: %w", name, err)
|
||||
|
||||
Reference in new issue
Block a user