[Git][debian-gis-team/asf-search][master] 4 commits: New upstream version 11.0.0
Antonio Valentino (@antonio.valentino)
gitlab at salsa.debian.org
Thu Dec 11 17:05:37 GMT 2025
Antonio Valentino pushed to branch master at Debian GIS Project / asf-search
Commits:
72266da8 by Antonio Valentino at 2025-12-11T17:00:50+00:00
New upstream version 11.0.0
- - - - -
05a45062 by Antonio Valentino at 2025-12-11T17:00:53+00:00
Update upstream source from tag 'upstream/11.0.0'
Update to upstream version '11.0.0'
with Debian dir 17c4cd1b19e766759f3f35df9c0b86fc1cf7b881
- - - - -
955cb681 by Antonio Valentino at 2025-12-11T17:01:30+00:00
New upstream release
- - - - -
1f3668a2 by Antonio Valentino at 2025-12-11T17:01:54+00:00
Set distribution to unstable
- - - - -
4 changed files:
- CHANGELOG.md
- asf_search/ASFSession.py
- asf_search/constants/INTERNAL.py
- debian/changelog
Changes:
=====================================
CHANGELOG.md
=====================================
@@ -25,6 +25,12 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-
-->
+------
+## [v11.0.0](https://github.com/asfadmin/Discovery-asf_search/compare/v10.3.0...v11.0.0)
+### Changed
+- `ASF_AUTH_HOST` `auth.asf.alaska.edu` replaced with `cumulus.asf.alaska.edu`. This change should be seamless
+- `auth_with_creds()` now queries `ASF_AUTH_HOST` for `asf-urs` cookie after generating EDL token via `https://urs.earthdata.nasa.gov/api/users/find_or_create_token`
+
------
## [v10.3.0](https://github.com/asfadmin/Discovery-asf_search/compare/v10.2.1...v10.3.0)
### Added
=====================================
asf_search/ASFSession.py
=====================================
@@ -1,5 +1,5 @@
import platform
-from typing import List, Union
+from typing import List, Optional, Union
import requests
from requests.utils import get_netrc_auth
from requests.auth import HTTPBasicAuth
@@ -13,13 +13,13 @@ import warnings
class ASFSession(requests.Session):
def __init__(
self,
- edl_host: str = None,
- edl_client_id: str = None,
- asf_auth_host: str = None,
- cmr_host: str = None,
- cmr_collections: str = None,
- auth_domains: List[str] = None,
- auth_cookie_names: List[str] = None,
+ edl_host: Optional[str] = None,
+ edl_client_id: Optional[str] = None,
+ asf_auth_host: Optional[str] = None,
+ cmr_host: Optional[str] = None,
+ cmr_collections: Optional[str] = None,
+ auth_domains: Optional[List[str]] = None,
+ auth_cookie_names: Optional[List[str]] = None,
):
"""
ASFSession is a subclass of `requests.Session`, and is meant to ease
@@ -99,6 +99,8 @@ class ASFSession(requests.Session):
"""
Authenticates the session using EDL username/password credentials
+ This method calls the /api/users/find_or_create_token endpoint to get an EDL token and sets the asf-urs cookie from an ASF auth host
+ (default `cumulus.asf.alaska.edu`)
Parameters
----------
username:
@@ -112,28 +114,14 @@ class ASFSession(requests.Session):
----------
ASFSession
"""
- from asf_search.constants import INTERNAL
self.auth = HTTPBasicAuth(username, password)
-
-
- # need this to set the asf-urs cookie for certain dataset downloads to work
- self._legacy_creds_auth()
-
- login_url = f'https://{self.edl_host}/api/users/find_or_create_token'
- ASF_LOGGER.info(f'Attempting to get account EDL Bearer token via "{login_url}"')
- response = self.post(login_url)
+ token = self._get_urs_access_token()
+ self._set_asf_urs_cookie()
- try:
- response.raise_for_status()
- except Exception as e:
- warnings.warn(f'Failed to get EDL Bearer token from {login_url}. Restricted datasets may be searchable, but downloading might fail.\nOriginal Exception: {str(e)}')
- else:
- token = response.json().get('access_token')
-
- ASF_LOGGER.info('EDL Bearer Token retreived, using for future queries and downloads')
- self.auth = None
- self._update_edl_token(token=token)
+ ASF_LOGGER.info('EDL Bearer Token retreived and asf-urs cookie sucessfully set')
+ self.auth = None
+ self._update_edl_token(token=token)
return self
@@ -141,6 +129,7 @@ class ASFSession(requests.Session):
"""
Authenticates the session using an EDL Authorization: Bearer token
+ Note: this does not set the asf-urs token, which is necessary for downloading certain products like SLC BURSTS
Parameters
----------
token:
@@ -166,33 +155,38 @@ class ASFSession(requests.Session):
return self
- def _legacy_creds_auth(self):
- login_url = f'https://{self.edl_host}/oauth/authorize?client_id={self.edl_client_id}&response_type=code&redirect_uri=https://{self.asf_auth_host}/login' # noqa F401
+ def _get_urs_access_token(self) -> str:
- ASF_LOGGER.info(f'Attempting to get "asf-urs" cookie via "{login_url}"')
- self.get(login_url)
+ login_url = f'https://{self.edl_host}/api/users/find_or_create_token'
+ ASF_LOGGER.info(f'Attempting to get account EDL Bearer token via "{login_url}"')
+ response = self.post(login_url)
+
+ try:
+ response.raise_for_status()
+ except Exception as e:
+ raise ASFAuthenticationError(f'Failed to log in with provided credentials. Original Exception: {str(e)}')
- if not self._check_auth_cookies(self.cookies.get_dict()):
- raise ASFAuthenticationError('Username or password is incorrect')
+ token = response.json().get('access_token')
+
+ ASF_LOGGER.info('EDL Bearer Token retreived, using for future queries and downloads')
+ return token
- ASF_LOGGER.info('Basic asf auth cookies set sucessfully')
+ def _set_asf_urs_cookie(self):
+ """Verify login via edl host and redirect to ASF_AUTH_HOST to set asf-urs auth cookies (need this for SLC Burst extractor)"""
+ login_url = f'https://{self.edl_host}/oauth/authorize?splash=false&client_id={self.edl_client_id}&response_type=code&redirect_uri=https://{self.asf_auth_host}/login' # noqa F401
- token = self.cookies.get_dict().get('urs-access-token')
+ ASF_LOGGER.info(f'Attempting to get "asf-urs" cookie via "{login_url}"')
+ response = self.get(login_url)
- if token is None:
- warnings.warn(
- f'Provided asf_auth_host "{self.asf_auth_host}" returned no EDL access token '
- 'during ASFSession validation. EDL Token expected in "urs-access-token" cookie, '
- 'required for searching hidden/restricted dataset access. '
- 'The current session will use basic authorization.'
- )
- else:
- ASF_LOGGER.info(
- 'Found "urs-access-token" cookie in response from auth host, '
- 'using token for searching for cmr queries.'
- )
- self._update_edl_token(token=token)
-
+ try:
+ response.raise_for_status()
+
+ if not self._check_auth_cookies(self.cookies.get_dict()):
+ raise ASFAuthenticationError(f'Failed to find `asf-urs` cookie in response from {login_url}. Unable to perform certain searches')
+
+ ASF_LOGGER.info(f'Authenticated {self.edl_host} against {self.asf_auth_host}, cookies set sucessfully')
+ except Exception as e:
+ raise ASFAuthenticationError(f'Failed to set asf-urs cookies. Original exception: {e}')
def _try_legacy_token_auth(self, token: str) -> bool:
"""
=====================================
asf_search/constants/INTERNAL.py
=====================================
@@ -1,4 +1,4 @@
-ASF_AUTH_HOST = 'auth.asf.alaska.edu'
+ASF_AUTH_HOST = 'cumulus.asf.alaska.edu'
CMR_HOST = 'cmr.earthdata.nasa.gov'
CMR_HOST_UAT = 'cmr.uat.earthdata.nasa.gov'
=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+asf-search (11.0.0-1) unstable; urgency=medium
+
+ * New upstream release.
+
+ -- Antonio Valentino <antonio.valentino at tiscali.it> Thu, 11 Dec 2025 17:01:40 +0000
+
asf-search (10.3.0-1) unstable; urgency=medium
* New upstream release.
View it on GitLab: https://salsa.debian.org/debian-gis-team/asf-search/-/compare/f140c7079012037dbe12fa7e31a066c86570de95...1f3668a2139cb43183ac86d211b8c31c6e33aa18
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/asf-search/-/compare/f140c7079012037dbe12fa7e31a066c86570de95...1f3668a2139cb43183ac86d211b8c31c6e33aa18
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20251211/6da3b5e9/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list