Skip to content

Commit bba419c

Browse files
Merge branch 'main' into carl/feedback-1b--login-command-ergonomics
2 parents 45d3433 + 3e53df7 commit bba419c

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

src/planet_auth_utils/commands/cli/main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,12 @@ def cmd_plauth_login(
185185
yes,
186186
):
187187
"""
188-
Perform an initial login, obtain user authorization, and save access
189-
tokens for the selected authentication profile. The specific process
190-
used depends on the selected options and authentication profile.
188+
Perform an initial login.
189+
190+
This command performs an initial login, obtains user authorization,
191+
and saves access tokens for the selected authentication profile.
192+
The specific process used depends on the selected options and
193+
authentication profile.
191194
"""
192195
extra = {}
193196
if project:

src/planet_auth_utils/commands/cli/oauth_cmd.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ def cmd_oauth_refresh(ctx, scope):
164164
It is possible to request a refresh token with scopes that are different
165165
from what is currently possessed, but you will never be granted
166166
more scopes than what the user has authorized.
167+
168+
This command only applies to auth profiles that use OAuth access tokens.
167169
"""
168170
_check_auth_client_type_for_click_ctx(ctx)
169171
saved_token = FileBackedOidcCredential(None, ctx.obj["AUTH"].token_file_path())
@@ -376,7 +378,8 @@ def cmd_oauth_revoke_refresh_token(ctx):
376378
@recast_exceptions_to_click(AuthException, FileNotFoundError)
377379
def cmd_oauth_userinfo(ctx):
378380
"""
379-
Look up user information from the auth server using the access token.
381+
Look up user information for the current user. Look up is performed by
382+
querying the authorization server using the current access token.
380383
"""
381384
_check_auth_client_type_for_click_ctx(ctx)
382385
saved_token = FileBackedOidcCredential(None, ctx.obj["AUTH"].token_file_path())
@@ -395,6 +398,7 @@ def cmd_oauth_userinfo(ctx):
395398
def cmd_oauth_print_access_token(ctx, refresh):
396399
"""
397400
Show the current OAuth access token. Stale tokens will be automatically refreshed.
401+
This command only applies to auth profiles that use OAuth access tokens.
398402
"""
399403
_check_auth_client_type_for_click_ctx(ctx)
400404
saved_token = FileBackedOidcCredential(None, ctx.obj["AUTH"].token_file_path())
@@ -428,8 +432,8 @@ def cmd_oauth_print_access_token(ctx, refresh):
428432
@recast_exceptions_to_click(AuthException, FileNotFoundError)
429433
def cmd_oauth_decode_jwt_access_token(ctx, human_readable):
430434
"""
431-
Decode a JWT access token locally and display its contents. NO
432-
VALIDATION IS PERFORMED. This function is intended for local
435+
Decode a JWT access token locally.
436+
NO VALIDATION IS PERFORMED. This function is intended for local
433437
debugging purposes. Note: Access tokens need not be JWTs.
434438
This function will not work for authorization servers that issue
435439
access tokens in other formats.
@@ -445,8 +449,8 @@ def cmd_oauth_decode_jwt_access_token(ctx, human_readable):
445449
@recast_exceptions_to_click(AuthException, FileNotFoundError)
446450
def cmd_oauth_decode_jwt_id_token(ctx, human_readable):
447451
"""
448-
Decode a JWT ID token locally and display its contents. NO
449-
VALIDATION IS PERFORMED. This function is intended for local
452+
Decode a JWT ID token locally.
453+
NO VALIDATION IS PERFORMED. This function is intended for local
450454
debugging purposes.
451455
"""
452456
_check_auth_client_type_for_click_ctx(ctx)
@@ -460,8 +464,8 @@ def cmd_oauth_decode_jwt_id_token(ctx, human_readable):
460464
@recast_exceptions_to_click(AuthException, FileNotFoundError)
461465
def cmd_oauth_decode_jwt_refresh_token(ctx, human_readable):
462466
"""
463-
Decode a JWT refresh token locally and display its contents. NO
464-
VALIDATION IS PERFORMED. This function is intended for local
467+
Decode a JWT refresh token locally.
468+
NO VALIDATION IS PERFORMED. This function is intended for local
465469
debugging purposes. Note: Refresh tokens need not be JWTs.
466470
This function will not work for authorization servers that issue
467471
refresh tokens in other formats.

src/planet_auth_utils/commands/cli/planet_legacy_auth_cmd.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ def cmd_pllegacy_login(ctx, auth_profile, username, password, sops, yes):
121121
@recast_exceptions_to_click(AuthException, FileNotFoundError)
122122
def cmd_pllegacy_print_api_key(ctx):
123123
"""
124-
Show the API Key used by the currently selected authentication profile.
124+
Show the current API Key. This command only applies to auth profiles
125+
that use simple API keys.
125126
"""
126127
# We also support StaticApiKeyAuthClient in some cases where the user
127128
# directly provides an API key. Such clients can use the legacy API
@@ -151,7 +152,7 @@ def cmd_pllegacy_print_api_key(ctx):
151152
@recast_exceptions_to_click(AuthException, FileNotFoundError)
152153
def cmd_pllegacy_print_access_token(ctx):
153154
"""
154-
Show the legacy JWT currently held by the selected authentication profile.
155+
Show the current legacy JWT access token.
155156
"""
156157
_check_client_type_pllegacy_for_click_ctx(ctx)
157158
saved_token = FileBackedPlanetLegacyApiKey(api_key_file=ctx.obj["AUTH"].token_file_path())

src/planet_auth_utils/commands/cli/profile_cmd.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,9 @@ def cmd_profile_copy(sops, src, dst):
271271
@recast_exceptions_to_click(AuthException, FileNotFoundError, PermissionError)
272272
def cmd_profile_set(selected_profile):
273273
"""
274-
Configure the default authentication profile to use when one is not otherwise specified.
274+
Configure the default authentication profile. Preference will be saved to disk
275+
and will be used when one is not otherwise specified. Command line options
276+
and environment variables override on-disk preferences.
275277
"""
276278
if not selected_profile:
277279
selected_profile = _dialogue_choose_auth_profile()

0 commit comments

Comments
 (0)