Skip to content

Commit

Permalink
Adding and using bearer auth to CvPartner OpenAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
trygvis committed Apr 17, 2024
1 parent f55f85e commit 606fc8d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cvbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get_cvpartner_api():
st.stop()

api_client = scienta.cvpartner_api.ApiClient()
api_client.set_default_header("Authorization", f"Bearer {cvpartner_api_key}")
api_client.configuration.access_token = cvpartner_api_key
api_client.configuration.server_variables["subdomain"] = "scienta"
return scienta.cvpartner_api.DefaultApi(api_client=api_client)

Expand Down
8 changes: 8 additions & 0 deletions cvpartner-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ servers:
subdomain:
default: ""

security:
- bearerAuth: []

paths:
/api/v3/cvs/{user_id}/{cv_id}:
get:
Expand Down Expand Up @@ -639,3 +642,8 @@ components:
properties:
url:
type: string

securitySchemes:
bearerAuth:
type: http
scheme: bearer
6 changes: 6 additions & 0 deletions scienta/cvpartner_api/api/default_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ def _find_countries_serialize(

# authentication setting
_auth_settings: List[str] = [
'bearerAuth'
]

return self.api_client.param_serialize(
Expand Down Expand Up @@ -578,6 +579,7 @@ def _get_cv_section_serialize(

# authentication setting
_auth_settings: List[str] = [
'bearerAuth'
]

return self.api_client.param_serialize(
Expand Down Expand Up @@ -851,6 +853,7 @@ def _get_full_cv_serialize(

# authentication setting
_auth_settings: List[str] = [
'bearerAuth'
]

return self.api_client.param_serialize(
Expand Down Expand Up @@ -1109,6 +1112,7 @@ def _get_user_by_id_serialize(

# authentication setting
_auth_settings: List[str] = [
'bearerAuth'
]

return self.api_client.param_serialize(
Expand Down Expand Up @@ -1380,6 +1384,7 @@ def _search_by_name_serialize(

# authentication setting
_auth_settings: List[str] = [
'bearerAuth'
]

return self.api_client.param_serialize(
Expand Down Expand Up @@ -1743,6 +1748,7 @@ def _user_search_serialize(

# authentication setting
_auth_settings: List[str] = [
'bearerAuth'
]

return self.api_client.param_serialize(
Expand Down
8 changes: 8 additions & 0 deletions scienta/cvpartner_api/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class Configuration:
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:Example:
"""

_default = None
Expand Down Expand Up @@ -349,6 +350,13 @@ def auth_settings(self):
:return: The Auth Settings information dict.
"""
auth = {}
if self.access_token is not None:
auth['bearerAuth'] = {
'type': 'bearer',
'in': 'header',
'key': 'Authorization',
'value': 'Bearer ' + self.access_token
}
return auth

def to_debug_report(self):
Expand Down

0 comments on commit 606fc8d

Please sign in to comment.