Skip to content

Commit b6b2709

Browse files
committed
docs and an example
1 parent 803d226 commit b6b2709

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module: satosa.micro_services.attribute_authorization.AttributeAuthorization
2+
name: AttributeAuthorization
3+
config:
4+
attribute_allow:
5+
target_provider1:
6+
requester1:
7+
attr1:
8+
- "^foo:bar$"
9+
- "^kaka$"
10+
default:
11+
attr1:
12+
- "plupp@.+$"
13+
"":
14+
"":
15+
attr2:
16+
- "^knytte:.*$"
17+
attribute_deny:
18+
default:
19+
default:
20+
eppn:
21+
- "^[^@]+$"

src/satosa/micro_services/attribute_authorization.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,43 @@ def _filters(f, requester, provider):
1010

1111
class AttributeAuthorization(ResponseMicroService):
1212

13+
"""
14+
A microservice that performs simple regexp-based authorization based on response
15+
attributes. The configuration assumes a dict with two keys: attributes_allow
16+
and attributes_deny. An examples speaks volumes:
17+
18+
```yaml
19+
config:
20+
attribute_allow:
21+
target_provider1:
22+
requester1:
23+
attr1:
24+
- "^foo:bar$"
25+
- "^kaka$"
26+
default:
27+
attr1:
28+
- "plupp@.+$"
29+
"":
30+
"":
31+
attr2:
32+
- "^knytte:.*$"
33+
attribute_deny:
34+
default:
35+
default:
36+
eppn:
37+
- "^[^@]+$"
38+
39+
```
40+
41+
The use of "" and 'default' is synonymous. Attribute rules are not overloaded
42+
or inherited. For instance a response from "provider2" would only be allowed
43+
through if the eppn attribute had all values containing an '@' (something
44+
perhaps best implemented via an allow rule in practice). Responses from
45+
target_provider1 bound for requester1 would be allowed through only if attr1
46+
contained foo:bar or kaka. Note that attribute filters (the leaves of the
47+
structure above) are ORed together - i.e any attribute match is sufficient.
48+
"""
49+
1350
def __init__(self, config, *args, **kwargs):
1451
super().__init__(*args, **kwargs)
1552
self.attribute_allow = config.get("attribute_allow", {})

0 commit comments

Comments
 (0)