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

Enable restricting read access #28

Closed
jirik opened this issue Oct 29, 2019 · 0 comments · Fixed by #114 or #179
Closed

Enable restricting read access #28

jirik opened this issue Oct 29, 2019 · 0 comments · Fixed by #114 or #179
Assignees
Labels
enhancement New feature or request

Comments

@jirik
Copy link
Member

jirik commented Oct 29, 2019

Currently, it's possible to restrict write permissions to publications using read everoyone, write owner authorization module.

This issue discuss what is necessary to restrict also read permissions. For Layman itself, it would be necessary.

First, we need to track user authentication and authorization for asynchronous celery tasks. For example in case of generate_map_thumbnail task it's necessary to pass authentication to timgen/hslayers, so that it can attach it to GET Map request that points back to Flask. It's not enough to store user credentials, because it can expire during long async tasks.

Probably the right way is to create some kind of per-request credentials on every incoming request, save it to redis (together with request and user information) and pass it to every async task. Be sure that app_context (g) is not shared between celery tasks on single worker. Async task then reads everything necessary from redis and it can use it for authentication of user (e.g. from timgen/hslayers). Furthermore layman.authn module should understand this kind of per-request credentials, so if such request with such credentials comes, Layman validates it in redis, reads user information from redis, and authenticates user.

Per-request credentials needs to be deleted immediately after all async tasks succeed or after any async task fails.

Second, we need to restrict access to WMS/WFS on per-layer base. Such restriction should be valid both for celery tasks (e.g. GetMap WMS request sent from timgen during generate_map_thumbnail or GetMap WMS request sent from Layman during generate_layer_thumbnail task) and for standalone WMS requests, e.g. sent from browser client.

GeoServer's HTTP header authentication filter can be used. Anyway, we need to put GeoServer behind proxy, and this proxy should exchange Layman-authentication credentials (e.g. OAuth2 HTTP headers) for GeoServer's "HTTP header" credentials.

Also it's probably necessary to register user on GeoServer first time it's authenticated in Layman even before PATCH User (because users without username are able to send requests), together with role, so that GeoServer's "HTTP header" can understand who this user is. How will be named user without username???

Third, to enable per-layer read restrictions, we need to store per-layer access permissons somewhere. GeoServer's User-Group service, Role service, and Layer Security system should be used, as GeoServer already understands it (so it does e.g. layer filtering in WMS GetCapabilities out-of-the-box).

It means to be able to set access permissions on POST Layers/Maps and PATCH Layer/Map, save it to GeoServer, and respect it on GeoServer and Layman.

Storing per-layer access permissons on GeoServer and respecting it on Layman and GeoServer will also enable per-layer write permissions.

@jirik jirik added the enhancement New feature or request label Apr 23, 2020
@index-git index-git added this to the E6.1 publication rights milestone Oct 8, 2020
@index-git index-git linked a pull request Oct 17, 2020 that will close this issue
index-git added a commit that referenced this issue Oct 27, 2020
index-git added a commit that referenced this issue Nov 9, 2020
index-git added a commit that referenced this issue Nov 9, 2020
index-git added a commit that referenced this issue Nov 16, 2020
jirik pushed a commit that referenced this issue Nov 17, 2020
index-git added a commit that referenced this issue Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants