docs: update policy types, add docs for expression policies
This commit is contained in:
parent
7f3d0113c2
commit
1b82283a20
|
@ -0,0 +1,19 @@
|
||||||
|
# Expression Policy
|
||||||
|
|
||||||
|
Expression Policies allows you to write custom Policy Logic using Jinja2 Templating language.
|
||||||
|
|
||||||
|
For a language reference, see [here](https://jinja.palletsprojects.com/en/2.11.x/templates/).
|
||||||
|
|
||||||
|
The following objects are passed into the variable:
|
||||||
|
|
||||||
|
- `request`: A PolicyRequest object, which has the following properties:
|
||||||
|
- `request.user`: The current User, which the Policy is applied against. ([ref](../../property-mappings/reference/user-object.md))
|
||||||
|
- `request.http_request`: The Django HTTP Request, as documented [here](https://docs.djangoproject.com/en/3.0/ref/request-response/#httprequest-objects).
|
||||||
|
- `request.obj`: A Django Model instance. This is only set if the Policy is ran against an object.
|
||||||
|
- `pb_is_sso_flow`: Boolean which is true if request was initiated by authenticating through an external Provider.
|
||||||
|
- `pb_is_group_member(user, group_name)`: Function which checks if `user` is member of a Group with Name `gorup_name`.
|
||||||
|
|
||||||
|
There are also the following custom filters available:
|
||||||
|
|
||||||
|
- `regex_match(regex)`: Return True if value matches `regex`
|
||||||
|
- `regex_replace(regex, repl)`: Replace string matched by `regex` with `repl`
|
|
@ -18,27 +18,9 @@ passbook keeps track of failed login attempts by Source IP and Attempted Usernam
|
||||||
|
|
||||||
This policy can be used to for example prompt Clients with a low score to pass a Captcha before they can continue.
|
This policy can be used to for example prompt Clients with a low score to pass a Captcha before they can continue.
|
||||||
|
|
||||||
### Field matcher Policy
|
## Expression Policy
|
||||||
|
|
||||||
This policy allows you to evaluate arbitrary comparisons against the User instance. Currently supported fields are:
|
See [Expression Policy](expression/index.md).
|
||||||
|
|
||||||
- Username
|
|
||||||
- E-Mail
|
|
||||||
- Name
|
|
||||||
- Is_active
|
|
||||||
- Date joined
|
|
||||||
|
|
||||||
Any of the following operations are supported:
|
|
||||||
|
|
||||||
- Starts with
|
|
||||||
- Ends with
|
|
||||||
- Contains
|
|
||||||
- Regexp (standard Python engine)
|
|
||||||
- Exact
|
|
||||||
|
|
||||||
### SSO Policy
|
|
||||||
|
|
||||||
This policy evaluates to True if the current Authentication Flow has been initiated through an external Source, like OAuth and SAML.
|
|
||||||
|
|
||||||
### Webhook Policy
|
### Webhook Policy
|
||||||
|
|
|
@ -13,11 +13,5 @@ The API exposes Username, E-Mail, Name and Groups in a GitHub-compatible format.
|
||||||
|
|
||||||
## SAML Provider
|
## SAML Provider
|
||||||
|
|
||||||
This provider allows you to integrate Enterprise Software using the SAML2 Protocol. It supports signed Requests. This Provider also has [Property Mappings](property-mappings.md#saml-property-mapping), which allows you to expose Vendor-specific Fields.
|
This provider allows you to integrate Enterprise Software using the SAML2 Protocol. It supports signed Requests. This Provider uses [Property Mappings](property-mappings/index.md#saml-property-mapping) to determine which fields are exposed and what values they return. This makes it possible to expose Vendor-specific Fields.
|
||||||
Default fields are:
|
Default fields are exposed through Auto-generated Property Mappings, which are prefixed with "Autogenerated..."
|
||||||
|
|
||||||
- `eduPersonPrincipalName`: User's E-Mail
|
|
||||||
- `cn`: User's Full Name
|
|
||||||
- `mail`: User's E-Mail
|
|
||||||
- `displayName`: User's Username
|
|
||||||
- `uid`: User Unique Identifier
|
|
||||||
|
|
|
@ -36,4 +36,4 @@ This source allows you to import Users and Groups from an LDAP Server
|
||||||
- Object uniqueness field: Field which contains a unique Identifier.
|
- Object uniqueness field: Field which contains a unique Identifier.
|
||||||
- Sync groups: Enable/disable Group synchronization. Groups are synced in the background every 5 minutes.
|
- Sync groups: Enable/disable Group synchronization. Groups are synced in the background every 5 minutes.
|
||||||
- Sync parent group: Optionally set this Group as parent Group for all synced Groups (allows you to, for example, import AD Groups under a root `imported-from-ad` group.)
|
- Sync parent group: Optionally set this Group as parent Group for all synced Groups (allows you to, for example, import AD Groups under a root `imported-from-ad` group.)
|
||||||
- Property mappings: Define which LDAP Properties map to which passbook Properties. The default set of Property Mappings is generated for Active Directory. See also [LDAP Property Mappings](property-mappings.md#ldap-property-mapping)
|
- Property mappings: Define which LDAP Properties map to which passbook Properties. The default set of Property Mappings is generated for Active Directory. See also [LDAP Property Mappings](property-mappings/index.md#ldap-property-mapping)
|
||||||
|
|
12
mkdocs.yml
12
mkdocs.yml
|
@ -10,9 +10,14 @@ nav:
|
||||||
- Kubernetes: installation/kubernetes.md
|
- Kubernetes: installation/kubernetes.md
|
||||||
- Sources: sources.md
|
- Sources: sources.md
|
||||||
- Providers: providers.md
|
- Providers: providers.md
|
||||||
- Property Mappings: property-mappings.md
|
- Property Mappings:
|
||||||
|
- Overview: property-mappings/index.md
|
||||||
|
- Reference:
|
||||||
|
- User Object: property-mappings/reference/user-object.md
|
||||||
- Factors: factors.md
|
- Factors: factors.md
|
||||||
- Policies: policies.md
|
- Policies:
|
||||||
|
- Overview: policies/index.md
|
||||||
|
- Expression: policies/expression/index.md
|
||||||
- Integrations:
|
- Integrations:
|
||||||
- as Provider:
|
- as Provider:
|
||||||
- Amazon Web Services: integrations/services/aws/index.md
|
- Amazon Web Services: integrations/services/aws/index.md
|
||||||
|
@ -21,9 +26,6 @@ nav:
|
||||||
- Harbor: integrations/services/harbor/index.md
|
- Harbor: integrations/services/harbor/index.md
|
||||||
- Sentry: integrations/services/sentry/index.md
|
- Sentry: integrations/services/sentry/index.md
|
||||||
- Ansible Tower/AWX: integrations/services/tower-awx/index.md
|
- Ansible Tower/AWX: integrations/services/tower-awx/index.md
|
||||||
- Reference:
|
|
||||||
- Property Mappings:
|
|
||||||
- User Object: reference/property-mappings/user-object.md
|
|
||||||
|
|
||||||
repo_name: "BeryJu.org/passbook"
|
repo_name: "BeryJu.org/passbook"
|
||||||
repo_url: https://github.com/BeryJu/passbook
|
repo_url: https://github.com/BeryJu/passbook
|
||||||
|
|
|
@ -11,10 +11,11 @@
|
||||||
Expression using <a href="https://jinja.palletsprojects.com/en/2.11.x/templates/">Jinja</a>. Following variables are available:
|
Expression using <a href="https://jinja.palletsprojects.com/en/2.11.x/templates/">Jinja</a>. Following variables are available:
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><code>request.user</code>: Passbook User Object (<a href="https://beryju.github.io/passbook/reference/property-mappings/user-object/">Reference</a>)</li>
|
<li><code>request.user</code>: Passbook User Object (<a href="https://beryju.github.io/passbook/property-mappings/reference/user-object/">Reference</a>)</li>
|
||||||
<li><code>request.http_request</code>: Django HTTP Request Object (<a href="https://docs.djangoproject.com/en/3.0/ref/request-response/#httprequest-objects">Reference</a>) </li>
|
<li><code>request.http_request</code>: Django HTTP Request Object (<a href="https://docs.djangoproject.com/en/3.0/ref/request-response/#httprequest-objects">Reference</a>) </li>
|
||||||
<li><code>request.obj</code>: Model the Policy is run against. </li>
|
<li><code>request.obj</code>: Model the Policy is run against. </li>
|
||||||
<li><code>pb_is_sso_flow</code>: Boolean which is true if request was initiated by by Authenticating through an external Provider.</li>
|
<li><code>pb_is_sso_flow</code>: Boolean which is true if request was initiated by authenticating through an external Provider.</li>
|
||||||
|
<li><code>pb_is_group_member(user, group_name)</code>: Function which checks if <code>user</code> is member of a Group with Name <code>group_name</code>.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>Custom Filters:</p>
|
<p>Custom Filters:</p>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
Reference in New Issue