databricks-cli/cmd
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
..
api Update databricks-sdk-go to latest (#102) 2022-11-24 21:41:57 +01:00
auth Added `bricks auth login` and `bricks auth token` (#158) 2023-01-06 16:15:57 +01:00
bundle Define flags for running jobs and pipelines (#146) 2022-12-23 15:17:16 +01:00
configure Run unit tests on windows and macos (#103) 2022-11-28 11:34:25 +01:00
fs Store project object in context.Context instead of global (#61) 2022-09-16 11:06:58 +02:00
init Add environments to project configuration (#68) 2022-09-22 13:40:11 +02:00
launch Replace terraform dependency with go sdk (#19) 2022-09-07 11:55:59 +02:00
prompt Store project object in context.Context instead of global (#61) 2022-09-16 11:06:58 +02:00
root Only display usage string on flag errors (#147) 2022-12-21 11:38:30 +01:00
sync Fix folder syncing on windows (#149) 2022-12-22 11:35:32 +01:00
test moved commands to own packages 2022-05-14 19:54:35 +02:00