mirror of
https://github.com/clearml/clearml
synced 2025-02-07 13:23:40 +00:00
Allow requesting custom token expiration using the api.auth.req_token_expiration_sec
configuration setting
This commit is contained in:
parent
88259094ac
commit
8cb4ac2acb
@ -54,5 +54,9 @@
|
|||||||
auth {
|
auth {
|
||||||
# When creating a request, if token will expire in less than this value, try to refresh the token
|
# When creating a request, if token will expire in less than this value, try to refresh the token
|
||||||
token_expiration_threshold_sec = 360
|
token_expiration_threshold_sec = 360
|
||||||
|
|
||||||
|
# token expiration time in seconds to request from the server. if not specified,
|
||||||
|
# server will set the default expiration
|
||||||
|
req_token_expiration_sec: null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,6 +139,8 @@ class Session(TokenManager):
|
|||||||
"auth.token_expiration_threshold_sec", 60
|
"auth.token_expiration_threshold_sec", 60
|
||||||
)
|
)
|
||||||
|
|
||||||
|
req_token_expiration_sec = self.config.get("api.auth.req_token_expiration_sec", None)
|
||||||
|
|
||||||
self._verbose = verbose if verbose is not None else ENV_VERBOSE.get()
|
self._verbose = verbose if verbose is not None else ENV_VERBOSE.get()
|
||||||
self._logger = logger
|
self._logger = logger
|
||||||
if self._verbose and not self._logger:
|
if self._verbose and not self._logger:
|
||||||
@ -165,7 +167,9 @@ class Session(TokenManager):
|
|||||||
|
|
||||||
# init the token manager
|
# init the token manager
|
||||||
super(Session, self).__init__(
|
super(Session, self).__init__(
|
||||||
token_expiration_threshold_sec=token_expiration_threshold_sec, **kwargs
|
token_expiration_threshold_sec=token_expiration_threshold_sec,
|
||||||
|
req_token_expiration_sec=req_token_expiration_sec,
|
||||||
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
host = host or self.get_api_server_host(config=self.config)
|
host = host or self.get_api_server_host(config=self.config)
|
||||||
|
Loading…
Reference in New Issue
Block a user