Skip to content

Commit e3296d4

Browse files
authored
Merge pull request #341 from TeskaLabs/feature/remove-seacat-access
Deprecate "seacat:access" resource ID
2 parents 3fa5e7a + 2863aab commit e3296d4

File tree

7 files changed

+14
-30
lines changed

7 files changed

+14
-30
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
# CHANGELOG
22

3+
## v24.06
4+
5+
### Pre-releases
6+
- `v24.06-alpha1`
7+
8+
### Features
9+
- Deprecate "seacat:access" resource ID (#341, `v24.06-alpha1`)
10+
11+
---
12+
13+
314
## v23.47
415

516
### Pre-releases
17+
- `v23.47-beta2`
618
- `v23.47-alpha7`
719
- `v23.47-alpha6`
820
- `v23.47-beta`

docs/access/resources.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,3 @@ The following resources are automatically available in an installation of SeaCat
4949
* `seacat:session:access`: List sessions and view session details.
5050
* `seacat:credentials:edit`: Edit and suspend credentials.
5151
* `seacat:credentials:access`: List credentials and view credentials details.
52-
* `seacat:access`: Access to Seacat Admin API and UI.

docs/installation/provisioning.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@ In the WebUI you will see that a provisioning tenant and a provisioning role hav
5151
## Setting up the environment
5252

5353
- **Create a tenant.** Any user must have at least one tenant assigned to them to be allowed into SeaCat WebUI.
54-
- **Create a superuser role.** To be able to execute some administrative commands it is necessary to have a superuser role assigned. This role must be created as **global**. After creating it, open the role detail and add the `authz:superuser` resource into the role. It is advisable to have at least one user with superuser rights.
55-
- `OPTIONAL` **Create a seacat-user role.** If you are using resource-based authorization in SeaCat WebUI or API, it is useful to have a role that allows its bearer to access the SeaCat WebUI but doesn't grant them superuser administrative rights. Create a role and assign the `seacat:access` resource to it.
5654
- **Create a user account.** The password will be sent via email or SMS, depending on what contact info you fill in. **Make sure that your SMTP or SMS provider is set up properly in SeaCat Auth config.**
57-
- Open the user detail and **assign the tenant and the role** that you created earlier.
55+
- Open the user detail and **assign the tenant** that you created earlier and the **`*/superuser` role**.
5856
- You can now log out of the provisioning superuser session.
5957
- Check if you have received the reset password link for your new credentials. Proceed to reset the password and then log in!
6058

docs/reference/resources.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ title: Resources
3333

3434
## SeaCat Auth admin resources
3535

36-
### `seacat:access`
37-
3836
### `authz:superuser`
3937

4038
### `authz:tenant:access`

seacatauth/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@
7171
# Specifies if non-public endpoints require authentication
7272
"require_authentication": "yes",
7373

74-
# Specifies resource required for API access
75-
# If set to "DISABLED", no authorization is required
76-
"authorization_resource": "seacat:access",
77-
7874
# DEV ONLY!
7975
# Allow authentication via access token
8076
# This imposes the risk of the access token being misused by 3rd party app (user impersonation)

seacatauth/authz/resource/service.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ class ResourceService(asab.Service):
2222

2323
# TODO: gather these system resources automatically
2424
_BuiltinResources = {
25-
"seacat:access": {
26-
"description": "Access to Seacat Admin API and UI.",
27-
},
2825
"authz:superuser": {
2926
"description": "Grants superuser access, including the access to all tenants.",
3027
},

seacatauth/middleware.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ async def app_middleware(request, handler):
2828
def private_auth_middleware_factory(app):
2929
oidc_service = app.get_service("seacatauth.OpenIdConnectService")
3030
require_authentication = asab.Config.getboolean("seacat:api", "require_authentication")
31-
api_resource_id = asab.Config.get("seacat:api", "authorization_resource")
3231
_allow_access_token_auth = asab.Config.getboolean("seacat:api", "_allow_access_token_auth")
3332
asab_api_required_bearer_token = asab.Config.get("asab:api:auth", "bearer", fallback=None)
3433

@@ -83,22 +82,7 @@ def has_resource_access(tenant: str, resource: str) -> bool:
8382

8483
# All API endpoints are considered non-public and have to pass authn/authz
8584
if request.Session is not None and request.Session.Authorization.Authz is not None:
86-
if api_resource_id == "DISABLED":
87-
return await handler(request)
88-
# Resource authorization is required: scan ALL THE RESOURCES
89-
# for `authorization_resource` or "authz:superuser"
90-
authorized_resources = set(
91-
resource
92-
for resources in request.Session.Authorization.Authz.values()
93-
for resource in resources
94-
)
95-
# Check the session is authorized to access Seacat API
96-
if "authz:superuser" in authorized_resources or api_resource_id in authorized_resources:
97-
return await handler(request)
98-
else:
99-
L.log(asab.LOG_NOTICE, "Not authorized to access Seacat API", struct_data={
100-
"resource_id": api_resource_id})
101-
return aiohttp.web.HTTPForbidden()
85+
return await handler(request)
10286

10387
# ASAB API can be protected with a pre-configured bearer token
10488
if (request.path.startswith("/asab/v1") or request.path in ("/doc", "/oauth2-redirect.html")) \

0 commit comments

Comments
 (0)