Skip to content

Commit

Permalink
utils for ID tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
tmaeno committed May 1, 2023
1 parent 7bf434c commit 9caea52
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
** Release Notes

1.5.47
* utilities for ID tokens

1.5.46
* to skip cpack if the user doesn't have own build dir

Expand Down
17 changes: 16 additions & 1 deletion pandaclient/Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,15 @@ def get_oidc(self, tmp_log):
return oidc

# get ID token
def get_id_token(self):
def get_id_token(self, force_new=False):
tmp_log = PLogger.getPandaLogger()
token_str = get_token_string(tmp_log, self.verbose)
if token_str:
self.idToken = token_str
return True
oidc = self.get_oidc(tmp_log)
if force_new:
oidc.cleanup()
s, o = oidc.run_device_authorization_flow()
if not s:
tmp_log.error(o)
Expand Down Expand Up @@ -1583,6 +1585,19 @@ def get_user_name_from_token():
return None, None


# get new token
def get_new_token():
"""Get new ID token
returns: a string of ID token. None if failed
"""
curl = _Curl()
if curl.get_id_token(force_new=True):
return curl.idToken
return None


# call idds command
def call_idds_command(command_name, args=None, kwargs=None, dumper=None, verbose=False, compress=False,
manager=False, loader=None, json_outputs=False):
Expand Down
2 changes: 1 addition & 1 deletion pandaclient/PandaToolsPkgInfo.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
release_version = "1.5.46"
release_version = "1.5.47"

0 comments on commit 9caea52

Please sign in to comment.