Custom Policy with Siddhi Query

10 views
Skip to first unread message

CHAIMA SOMRANI

unread,
Sep 15, 2023, 12:19:15 PM9/15/23
to siddhi-dev

Give me please a siddhi query which will allow access to API 1 only through the addresses @ip1 and @ip2. If @ip3 wants to access API 1 it will be blocked

Please provide me with a Siddhi query that permits access to API 1 exclusively from the IP addresses @ip1 and @ip2. If @ip3 attempts to access API 1, it should be denied.

Senthuran Ambalavanar

unread,
Sep 16, 2023, 4:36:17 AM9/16/23
to CHAIMA SOMRANI, siddhi-dev
Hi,

Could you please explain what you mean by allowing access / blocking access to an API in your use case?
If we consider checking & filtering the IP address part, it would be something like:

define stream RequestStream(ipAddress string);
define stream AllowStream(ipAddress string);
define stream BlockStream(ipAddress string);

from RequestStream[ipAddress == "@ip1" or ipAddress == "@ip2"]
select *
insert into AllowStream;

from RequestStream[ipAddress == "@ip3"]
select *
insert into BlockStream;

Thanks,
Senthuran.




On Fri, Sep 15, 2023 at 9:49 PM CHAIMA SOMRANI <chaima....@enis.tn> wrote:

Give me please a siddhi query which will allow access to API 1 only through the addresses @ip1 and @ip2. If @ip3 wants to access API 1 it will be blocked

Please provide me with a Siddhi query that permits access to API 1 exclusively from the IP addresses @ip1 and @ip2. If @ip3 attempts to access API 1, it should be denied.

--
Siddhi homepage: http://siddhi.io/
Siddhi Github repo: https://github.com/siddhi-io/siddhi
 
You received this message because you are subscribed to the Google Groups "Siddhi-dev" group.
To post to this group, send email to siddh...@googlegroups.com
To unsubscribe from this group, send email to siddhi-dev+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/siddhi-dev?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups "siddhi-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to siddhi-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/siddhi-dev/1d791499-5831-4aff-9b03-32ad1d2cdab4n%40googlegroups.com.


--
Senthuran Ambalavanar | Associate Technical Lead | WSO2 LLC
Reply all
Reply to author
Forward
0 new messages