forked from loafle/openapi-generator-original
[Python] support api key refresh in configuration module (#3594)
This commit is contained in:
committed by
William Cheng
parent
a4811c7850
commit
99fcfbc802
@@ -61,6 +61,9 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
|
|||||||
self.api_key_prefix = api_key_prefix
|
self.api_key_prefix = api_key_prefix
|
||||||
"""dict to store API prefix (e.g. Bearer)
|
"""dict to store API prefix (e.g. Bearer)
|
||||||
"""
|
"""
|
||||||
|
self.refresh_api_key_hook = None
|
||||||
|
"""function hook to refresh API key if expired
|
||||||
|
"""
|
||||||
self.username = username
|
self.username = username
|
||||||
"""Username for HTTP basic authentication
|
"""Username for HTTP basic authentication
|
||||||
"""
|
"""
|
||||||
@@ -238,6 +241,8 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
|
|||||||
:param identifier: The identifier of apiKey.
|
:param identifier: The identifier of apiKey.
|
||||||
:return: The token for api key authentication.
|
:return: The token for api key authentication.
|
||||||
"""
|
"""
|
||||||
|
if self.refresh_api_key_hook is not None:
|
||||||
|
self.refresh_api_key_hook(self)
|
||||||
key = self.api_key.get(identifier)
|
key = self.api_key.get(identifier)
|
||||||
if key:
|
if key:
|
||||||
prefix = self.api_key_prefix.get(identifier)
|
prefix = self.api_key_prefix.get(identifier)
|
||||||
|
|||||||
@@ -66,6 +66,9 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
|
|||||||
self.api_key_prefix = api_key_prefix
|
self.api_key_prefix = api_key_prefix
|
||||||
"""dict to store API prefix (e.g. Bearer)
|
"""dict to store API prefix (e.g. Bearer)
|
||||||
"""
|
"""
|
||||||
|
self.refresh_api_key_hook = None
|
||||||
|
"""function hook to refresh API key if expired
|
||||||
|
"""
|
||||||
self.username = username
|
self.username = username
|
||||||
"""Username for HTTP basic authentication
|
"""Username for HTTP basic authentication
|
||||||
"""
|
"""
|
||||||
@@ -223,6 +226,8 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
|
|||||||
:param identifier: The identifier of apiKey.
|
:param identifier: The identifier of apiKey.
|
||||||
:return: The token for api key authentication.
|
:return: The token for api key authentication.
|
||||||
"""
|
"""
|
||||||
|
if self.refresh_api_key_hook is not None:
|
||||||
|
self.refresh_api_key_hook(self)
|
||||||
key = self.api_key.get(identifier)
|
key = self.api_key.get(identifier)
|
||||||
if key:
|
if key:
|
||||||
prefix = self.api_key_prefix.get(identifier)
|
prefix = self.api_key_prefix.get(identifier)
|
||||||
|
|||||||
@@ -67,6 +67,9 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
|
|||||||
self.api_key_prefix = api_key_prefix
|
self.api_key_prefix = api_key_prefix
|
||||||
"""dict to store API prefix (e.g. Bearer)
|
"""dict to store API prefix (e.g. Bearer)
|
||||||
"""
|
"""
|
||||||
|
self.refresh_api_key_hook = None
|
||||||
|
"""function hook to refresh API key if expired
|
||||||
|
"""
|
||||||
self.username = username
|
self.username = username
|
||||||
"""Username for HTTP basic authentication
|
"""Username for HTTP basic authentication
|
||||||
"""
|
"""
|
||||||
@@ -227,6 +230,8 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
|
|||||||
:param identifier: The identifier of apiKey.
|
:param identifier: The identifier of apiKey.
|
||||||
:return: The token for api key authentication.
|
:return: The token for api key authentication.
|
||||||
"""
|
"""
|
||||||
|
if self.refresh_api_key_hook is not None:
|
||||||
|
self.refresh_api_key_hook(self)
|
||||||
key = self.api_key.get(identifier)
|
key = self.api_key.get(identifier)
|
||||||
if key:
|
if key:
|
||||||
prefix = self.api_key_prefix.get(identifier)
|
prefix = self.api_key_prefix.get(identifier)
|
||||||
|
|||||||
@@ -67,6 +67,9 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
|
|||||||
self.api_key_prefix = api_key_prefix
|
self.api_key_prefix = api_key_prefix
|
||||||
"""dict to store API prefix (e.g. Bearer)
|
"""dict to store API prefix (e.g. Bearer)
|
||||||
"""
|
"""
|
||||||
|
self.refresh_api_key_hook = None
|
||||||
|
"""function hook to refresh API key if expired
|
||||||
|
"""
|
||||||
self.username = username
|
self.username = username
|
||||||
"""Username for HTTP basic authentication
|
"""Username for HTTP basic authentication
|
||||||
"""
|
"""
|
||||||
@@ -227,6 +230,8 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
|
|||||||
:param identifier: The identifier of apiKey.
|
:param identifier: The identifier of apiKey.
|
||||||
:return: The token for api key authentication.
|
:return: The token for api key authentication.
|
||||||
"""
|
"""
|
||||||
|
if self.refresh_api_key_hook is not None:
|
||||||
|
self.refresh_api_key_hook(self)
|
||||||
key = self.api_key.get(identifier)
|
key = self.api_key.get(identifier)
|
||||||
if key:
|
if key:
|
||||||
prefix = self.api_key_prefix.get(identifier)
|
prefix = self.api_key_prefix.get(identifier)
|
||||||
|
|||||||
@@ -67,6 +67,9 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
|
|||||||
self.api_key_prefix = api_key_prefix
|
self.api_key_prefix = api_key_prefix
|
||||||
"""dict to store API prefix (e.g. Bearer)
|
"""dict to store API prefix (e.g. Bearer)
|
||||||
"""
|
"""
|
||||||
|
self.refresh_api_key_hook = None
|
||||||
|
"""function hook to refresh API key if expired
|
||||||
|
"""
|
||||||
self.username = username
|
self.username = username
|
||||||
"""Username for HTTP basic authentication
|
"""Username for HTTP basic authentication
|
||||||
"""
|
"""
|
||||||
@@ -227,6 +230,8 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
|
|||||||
:param identifier: The identifier of apiKey.
|
:param identifier: The identifier of apiKey.
|
||||||
:return: The token for api key authentication.
|
:return: The token for api key authentication.
|
||||||
"""
|
"""
|
||||||
|
if self.refresh_api_key_hook is not None:
|
||||||
|
self.refresh_api_key_hook(self)
|
||||||
key = self.api_key.get(identifier)
|
key = self.api_key.get(identifier)
|
||||||
if key:
|
if key:
|
||||||
prefix = self.api_key_prefix.get(identifier)
|
prefix = self.api_key_prefix.get(identifier)
|
||||||
|
|||||||
Reference in New Issue
Block a user