Skip to content

Commit

Permalink
Fail on missing tenant and token url (#336)
Browse files Browse the repository at this point in the history
Co-authored-by: cognite-bulldozer[bot] <51074376+cognite-bulldozer[bot]@users.noreply.github.com>
  • Loading branch information
einarmo and cognite-bulldozer[bot] authored Jun 25, 2024
1 parent 6c75671 commit 154b4ee
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ Changes are grouped as follows
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.

## 7.2.2

### Fixed

* Produce a config error when missing token-url and tenant, instead of eventually
producing an `OAuth 2 MUST utilize https` error when getting the token.

## 7.2.1

Expand Down
2 changes: 1 addition & 1 deletion cognite/extractorutils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
Cognite extractor utils is a Python package that simplifies the development of new extractors.
"""

__version__ = "7.2.1"
__version__ = "7.2.2"
from .base import Extractor
2 changes: 2 additions & 0 deletions cognite/extractorutils/configtools/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ def get_cognite_client(
elif self.idp_authentication.tenant:
base_url = urljoin(self.idp_authentication.authority, self.idp_authentication.tenant)
kwargs["token_url"] = f"{base_url}/oauth2/v2.0/token"
else:
raise InvalidConfigError("Either token-url or tenant is required for client credentials authentication")
kwargs["client_id"] = self.idp_authentication.client_id
kwargs["client_secret"] = self.idp_authentication.secret
kwargs["scopes"] = self.idp_authentication.scopes
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cognite-extractor-utils"
version = "7.2.1"
version = "7.2.2"
description = "Utilities for easier development of extractors for CDF"
authors = ["Mathias Lohne <[email protected]>"]
license = "Apache-2.0"
Expand Down

0 comments on commit 154b4ee

Please sign in to comment.