Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions src/blueapi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,26 +236,20 @@ class OIDCConfig(BlueapiBaseModel):

@model_validator(mode="after")
def check_urls(self) -> Self:
if self.issuer is None and self.well_known_url is None:
if self.issuer is None and self.__dict__.get("well_known_url") is None:
raise ValueError("Please provide 'OIDCConfig.issuer'")
if self.well_known_url:
if self.__dict__.get("well_known_url"):
LOGGER.warning(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should either raise a warning or log a message. Logging a warning is not really doing either how they're intended.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I've made it a log message

DeprecationWarning(
"OIDCConfig.well_known_url is deprecated, "
"Please use OIDCConfig.issuer"
),
"OIDCConfig.well_known_url is deprecated, Please use OIDCConfig.issuer"
)
return self

@cached_property
def _well_known_url(self) -> str:
if self.issuer:
if self.well_known_url:
if self.__dict__.get("well_known_url"):
LOGGER.warning(
DeprecationWarning(
"well_known_url and issuer are both set. "
"Defaulting to issuer URL"
),
"well_known_url and issuer are both set. Defaulting to issuer URL"
)
return self.issuer + "/.well-known/openid-configuration"
return cast(str, self.well_known_url)
Expand Down
Loading