Richard Nordström
37067ef933
rename DeleteKey to Delete
2024-09-23 20:21:38 +02:00
Richard Nordström
6a8b2f452f
use PersistentAuth struc
2024-09-01 20:20:21 +02:00
Richard Nordström
882ccba0f5
add DeleteKey to TokenCache for logout cmd
2024-09-01 20:20:21 +02:00
Serge Smertin
945d522dab
Propagate correct `User-Agent` for CLI ( #1264 )
...
## Changes
This PR migrates `databricks auth login` HTTP client to the one from Go
SDK, making API calls more robust and containing our unified user agent.
## Tests
Unit tests left almost unchanged
2024-03-11 22:24:23 +00:00
Serge Smertin
b87b4b0f40
Added `bricks auth login` and `bricks auth token` ( #158 )
...
# Auth challenge (happy path)
Simplified description of [PKCE](https://oauth.net/2/pkce/ )
implementation:
```mermaid
sequenceDiagram
autonumber
actor User
User ->> CLI: type `bricks auth login HOST`
CLI ->>+ HOST: request OIDC endpoints
HOST ->>- CLI: auth & token endpoints
CLI ->> CLI: start embedded server to consume redirects (lock)
CLI -->>+ Auth Endpoint: open browser with RND1 + SHA256(RND2)
User ->>+ Auth Endpoint: Go through SSO
Auth Endpoint ->>- CLI: AUTH CODE + 'RND1 (redirect)
CLI ->>+ Token Endpoint: Exchange: AUTH CODE + RND2
Token Endpoint ->>- CLI: Access Token (JWT) + refresh + expiry
CLI ->> Token cache: Save Access Token (JWT) + refresh + expiry
CLI ->> User: success
```
# Token refresh (happy path)
```mermaid
sequenceDiagram
autonumber
actor User
User ->> CLI: type `bricks token HOST`
CLI ->> CLI: acquire lock (same local addr as redirect server)
CLI ->>+ Token cache: read token
critical token not expired
Token cache ->>- User: JWT (without refresh)
option token is expired
CLI ->>+ HOST: request OIDC endpoints
HOST ->>- CLI: auth & token endpoints
CLI ->>+ Token Endpoint: refresh token
Token Endpoint ->>- CLI: JWT (refreshed)
CLI ->> Token cache: save JWT (refreshed)
CLI ->> User: JWT (refreshed)
option no auth for host
CLI -X User: no auth configured
end
```
2023-01-06 16:15:57 +01:00