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

remove security handling in WCMP2 links #812

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 0 additions & 5 deletions tests/integration/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,6 @@ def test_metadata_discovery_publish():
assert 'has_auth' in r['wis2box']
assert r['wis2box']['has_auth']

for link in r['links']:
if link['rel'] == 'collection' and link['title'] == id_:
assert link['security']['default']['type'] == 'http'
assert link['security']['default']['scheme'] == 'bearer'


def test_data_ingest():
"""Test data ingest/process publish"""
Expand Down
39 changes: 1 addition & 38 deletions wis2box-management/wis2box/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@
import requests
from secrets import token_hex

from owslib.ogcapi.records import Records

from wis2box import cli_helpers
from wis2box.api import upsert_collection_item
from wis2box.data_mappings import get_data_mappings
from wis2box.env import AUTH_URL, DOCKER_API_URL
from wis2box.env import AUTH_URL


LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -173,27 +170,6 @@ def add_token(ctx, metadata_id, path, yes, token):
if create_token(path, token):
click.echo('Token successfully created')

if metadata_id is not None:
click.echo('Adding access control object to discovery metadata')

oar = Records(DOCKER_API_URL)

record = oar.collection_item('discovery-metadata', metadata_id)
record['wis2box']['has_auth'] = True

for link in record['links']:
if link['rel'] == 'collection' and link['title'] == metadata_id:
LOGGER.debug('Adding security object to link')
link['security'] = {
'default': {
'type': 'http',
'scheme': 'bearer',
'description': 'Please contact the data provider for access' # noqa
}
}

upsert_collection_item('discovery-metadata', record)


@click.command()
@click.pass_context
Expand All @@ -216,19 +192,6 @@ def remove_token(ctx, metadata_id, path, token):
if delete_token(path, token):
click.echo('Token successfully deleted')

if metadata_id is not None:
click.echo('Removing access control object to discovery metadata')

oar = Records(DOCKER_API_URL)

record = oar.collection_item('discovery-metadata', metadata_id)
record['wis2box'].pop('has_auth', None)
for link in record['links']:
if 'security' in link:
link.pop('security', None)

upsert_collection_item('discovery-metadata', record)


auth.add_command(add_token)
auth.add_command(remove_token)
Expand Down
Loading