Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PXP-10358 Add client_auth_mapping function #49

Merged
merged 3 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
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
13 changes: 6 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,19 @@ cache:
- apt
install:
- cd python
- curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
- $HOME/.poetry/bin/poetry install
- $HOME/.poetry/bin/poetry run pip list
- pip install poetry
- poetry install
script:
- $HOME/.poetry/bin/poetry run pytest -vv --cov=src --cov-report xml tests
- poetry run pytest -vv --cov=src --cov-report xml tests
after_script:
- pip install codacy-coverage
- python-codacy-coverage -r coverage.xml
before_deploy:
- $HOME/.poetry/bin/poetry config http-basic.pypi $PYPI_USER $PYPI_PASSWORD
- $HOME/.poetry/bin/poetry build
- poetry config http-basic.pypi $PYPI_USER $PYPI_PASSWORD
- poetry build
deploy:
provider: script
script: "$HOME/.poetry/bin/poetry publish"
script: "poetry publish"
skip_cleanup: true
on:
python: 3.7
Expand Down
15 changes: 15 additions & 0 deletions python/src/gen3authz/client/arborist/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,21 @@ async def auth_mapping(self, username):
raise ArboristError(response.error_msg, response.code)
return response.json

@maybe_sync
async def client_auth_mapping(self, client_id):
"""
For given client, get mapping from the resources that this client can access
to the actions on those resources for which it is authorized.

Return:
dict: response JSON from arborist
"""
data = {"clientID": client_id}
response = await self.post(self._auth_url.rstrip("/") + "/mapping", json=data)
if not response.successful:
raise ArboristError(response.error_msg, response.code)
return response.json

@maybe_sync
async def auth_request(self, jwt, service, methods, resources, user_id=None):
"""
Expand Down