Plugin system for extending supported auth methods
The goal is to allow users to implement custom auth strategies that aren't currently supported. This would also serve as a substitute for HTTPie's auth plugin system.
Related issues that might benefit from this:
- https://github.com/ducaale/xh/issues/284
- https://github.com/ducaale/xh/issues/328
- https://github.com/ducaale/xh/issues/414
I thought about relying on inline shell invocation (--auth-type=bearer --auth=$(get-oauth-token qa)), but that wouldn't work if the auth needs access to the request itself (e.g cURL's --aws-sigv4).
One possible approach is to support:
xh --auth-type=plugin:hmac-sha256 --auth=signature-secretThis would look for an executable like xh-hmac-sha256 (similar to how cargo handles custom commands) and pass it the request details (i.e URL, headers, body, content of --auth). The plugin would output headers to include in the final request.
I would like to hear if this direction makes sense and any other alternatives we should consider.
Source: ducaale/xh