Skip to content

Commit

Permalink
clearer method name
Browse files Browse the repository at this point in the history
  • Loading branch information
byewokko committed Feb 24, 2025
1 parent 7babe13 commit 3dd06b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion asab/api/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def session(
"Internal auth is disabled because 'jwcrypto' module is not installed. "
"Please run 'pip install jwcrypto' or install asab with 'authz' optional dependency."
)
_headers["Authorization"] = self.InternalAuth.get_bearer_token()
_headers["Authorization"] = self.InternalAuth.get_authorization_header()

else:
raise ValueError(
Expand Down
5 changes: 4 additions & 1 deletion asab/api/internal_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async def initialize(self, app):
self._schedule_key_and_token_update()


def get_bearer_token(self) -> str:
def get_authorization_header(self) -> str:
"""
Obtain a Bearer token for internal authorized communication.
Expand All @@ -90,6 +90,9 @@ def get_bearer_token(self) -> str:
if not self._is_id_token_ready():
self._issue_id_token()

if self.IdToken is None:
raise RuntimeError("Internal auth token is not available.")

return "Bearer {}".format(self.IdToken.serialize())


Expand Down

0 comments on commit 3dd06b4

Please sign in to comment.