From 256187ebc684e97a0c0e7b7c9ff6740126f134ed Mon Sep 17 00:00:00 2001 From: Rukk385 <39340512+Rukk385@users.noreply.github.com> Date: Wed, 20 Dec 2023 15:33:58 +0100 Subject: [PATCH] website/docs: add expression example for geoip (#7739) * Update expression.mdx Added example for GeoIP Signed-off-by: Rukk385 <39340512+Rukk385@users.noreply.github.com> * Update website/docs/policies/expression.mdx Co-authored-by: Marc 'risson' Schmitt Signed-off-by: Rukk385 <39340512+Rukk385@users.noreply.github.com> --------- Signed-off-by: Rukk385 <39340512+Rukk385@users.noreply.github.com> Co-authored-by: Marc 'risson' Schmitt --- website/docs/policies/expression.mdx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/website/docs/policies/expression.mdx b/website/docs/policies/expression.mdx index 2200cc96f..aaf850608 100644 --- a/website/docs/policies/expression.mdx +++ b/website/docs/policies/expression.mdx @@ -54,6 +54,11 @@ import Objects from "../expressions/_objects.md"; - `request.context`: A dictionary with dynamic data. This depends on the origin of the execution. - `geoip`: GeoIP object, see [GeoIP](https://geoip2.readthedocs.io/en/latest/#geoip2.models.City) + + ```python + return context["geoip"].country.iso_code == "US" + ``` + - `ak_is_sso_flow`: Boolean which is true if request was initiated by authenticating through an external provider. - `ak_client_ip`: Client's IP Address or 255.255.255.255 if no IP Address could be extracted. Can be [compared](#comparing-ip-addresses), for example