Skip to content

AccessControlList

sunng87 edited this page Mar 9, 2012 · 4 revisions
Clone this wiki locally

ACL module can be enabled via assigning IP-based rules during Slacker server startup.

Define ACL rules

defrules provides a DSL to define access rules.

Code examples:

(use 'slacker.acl)

;; All IP are denied by default !
(defrunles myrules
  )

;; If an IP is denied explicitly, whatever it's in an allowed IP segment or not, it will be denied.
;; allow IP within 192.168.1.* and 192.168.100.* to access
(defrules myrules
  (allow ["192.168.1.*" "192.168.100.*"]))

;;Any IP within 192.168.1.* and 192.168.100.* is allowed except 192.168.1.10
(defrules myrules
  (deny ["192.168.1.10"])
  (allow ["192.168.1.*" "192.168.100.*"]))

;All IP is allowed 
(defrules myrules
  (allow :all))

Enable ACL

ACL module can be enabled during Slacker server startup.

(start-slacker-server (the-ns 'slacker.example.api) 2104
                      :acl myrules)
Something went wrong with that request. Please try again.