AuthCli¶
AuthCli is used by UnityCatalogCli to handle auth sub-commands.
$ ./bin/uc auth --help
Please provide a valid sub-command for auth.
Valid sub-commands for auth are: login
For detailed help on auth sub-commands, use bin/uc auth <sub-command> --help
Exchange and Login¶
login and exchange use doExchange for authentication with the following difference:
- login uses Oauth2CliExchange to authenticate and generate an identity token.
- exchange expects an identity token to be given (using
identity_tokenoption on command line).
Handle Command Line¶
handle handles the given cmd.
| Subcommand | Handler |
|---|---|
login | One of the following based on identity_token option: |
handle is used when:
UnityCatalogCliis launched on command line withauthcommand
Exchange¶
exchange de-serializes the given json object into a collection (that is supposed to include identityToken key based on identity_token CLI parameter).
exchange doExchange with the identityToken identity token.
login is used when:
AuthCliis requested to handleloginsubcommand withidentity_tokenoption used on the command line
Login¶
login creates a Oauth2CliExchange to authenticate (and create an identity token).
In the end, login doExchange with the identity token as the value of identityToken key in the login input map).
login is used when:
AuthCliis requested to handleloginsubcommand with noidentity_tokenoption used on the command line
doExchange¶
doExchange requests the given ApiClient for the base URI to access /auth/tokens API endpoint with the following query parameters:
| Query Parameter | Value |
|---|---|
grant_type | urn:ietf:params:oauth:grant-type:token-exchange |
requested_token_type | urn:ietf:params:oauth:token-type:access_token |
subject_token_type | urn:ietf:params:oauth:token-type:id_token |
subject_token | The value of identityToken in the given login collection |
doExchange sends a POST request to /auth/tokens API endpoint with application/x-www-form-urlencoded content type.
In the end, doExchange creates a LoginInfo with access_token (from the response).