Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Forbid ¶
func Forbid(_ httprouter.Handle, _ ...string) httprouter.Handle
Forbid is special function to disable specific route with 403 status code. It is useful to programmatically shutoff access to the specific resource.
func NoAuth ¶
func NoAuth(h httprouter.Handle, _ ...string) httprouter.Handle
NoAuth is a dummy function to bypass httprouter.Handle. It is useful to route unprotected resources.
func UnAuth ¶
func UnAuth(_ httprouter.Handle, _ ...string) httprouter.Handle
UnAuth is special function to disable specific route with 401 status code. It is useful to programmatically shutoff access to the specific resource.
Types ¶
type AuthWrapper ¶
type AuthWrapper func(httprouter.Handle, ...string) httprouter.Handle
AuthWrapper is wrapper function for httprouter.Handle. It receives httprouter.Handle and returns httprouter.Handle, that means users can write their own rule for session handling inside this type of function.
func AuthAND ¶
func AuthAND(auth1 AuthWrapper, auth2 AuthWrapper) AuthWrapper
AuthAND realizes function synthesis (AND pipeline) for two filter.AuthWrapper. Two authentication wrappers (auth1 and auth2) are applied for inbound traffic in the order, and finally returns httprouter.Handle for route for valid traffics.
func AuthAll ¶
func AuthAll(auth ...AuthWrapper) AuthWrapper
AuthAll realizes two or more AuthWrapper pipeline with AND condition. (experimental)
func AuthOR ¶
func AuthOR(auth1 AuthWrapper, auth2 AuthWrapper) AuthWrapper
AuthOR realizes function parallel (OR pipeline) for two filter.AuthWrapper.
The first evaluated handler `auth1(handle)` (httprouter.Handle, _ ...string) must return status code 200 at valid result. But, if the first function is expected to fail, it must not return StatusOk for the response and subsequent handler `auth2(handle)` should be evaluated immediately.