Documentation ¶
Index ¶
- Constants
- type CachedMatcher
- type Handler
- func (h *Handler) Create(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (h *Handler) Delete(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (h *Handler) Get(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (h *Handler) List(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (h *Handler) SetRoutes(r *httprouter.Router)
- func (h *Handler) Update(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- type Manager
- type Matcher
- type MemoryManager
- type Rule
- type SQLManager
- func (s *SQLManager) CreateRule(rule *Rule) error
- func (s *SQLManager) CreateSchemas() (int, error)
- func (s *SQLManager) DeleteRule(id string) error
- func (s *SQLManager) GetRule(id string) (*Rule, error)
- func (s *SQLManager) ListRules() ([]Rule, error)
- func (s *SQLManager) UpdateRule(rule *Rule) error
Constants ¶
const AnonymousMode = "anonymous"
const AuthenticatedMode = "authenticated"
const BypassMode = "bypass"
const PolicyMode = "policy"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachedMatcher ¶
func (*CachedMatcher) Refresh ¶
func (m *CachedMatcher) Refresh() error
type Handler ¶
func (*Handler) Create ¶
func (h *Handler) Create(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
swagger:route POST /rules rule createRule
Create a rule ¶
This method allows creation of rules. If a rule id exists, you will receive an error.
Consumes: - application/json Produces: - application/json Schemes: http, https Responses: 201: rule 401: genericError 403: genericError 500: genericError
func (*Handler) Delete ¶
func (h *Handler) Delete(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
swagger:route DELETE /rules/{id} rule deleteRule
Delete a rule ¶
Use this endpoint to delete a rule.
Consumes: - application/json Produces: - application/json Schemes: http, https Responses: 204: emptyResponse 401: genericError 403: genericError 404: genericError 500: genericError
func (*Handler) Get ¶
func (h *Handler) Get(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
swagger:route GET /rules/{id} rule getRule
Retrieve a rule ¶
Use this method to retrieve a rule from the storage. If it does not exist you will receive a 404 error.
Consumes: - application/json Produces: - application/json Schemes: http, https Responses: 200: rule 401: genericError 403: genericError 404: genericError 500: genericError
func (*Handler) List ¶
func (h *Handler) List(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
swagger:route GET /rules rule listRules
List all rules ¶
This method returns an array of all rules that are stored in the backend. This is useful if you want to get a full view of what rules you have currently in place.
Consumes: - application/json Produces: - application/json Schemes: http, https Responses: 200: rules 401: genericError 403: genericError 500: genericError
func (*Handler) SetRoutes ¶
func (h *Handler) SetRoutes(r *httprouter.Router)
func (*Handler) Update ¶
func (h *Handler) Update(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
swagger:route PUT /rules/{id} rule updateRule
Update a rule ¶
Use this method to update a rule. Keep in mind that you need to send the full rule payload as this endpoint does not support patching.
Consumes: - application/json Produces: - application/json Schemes: http, https Responses: 200: rule 401: genericError 403: genericError 404: genericError 500: genericError
type MemoryManager ¶
func NewMemoryManager ¶
func NewMemoryManager() *MemoryManager
func (*MemoryManager) CreateRule ¶
func (m *MemoryManager) CreateRule(rule *Rule) error
func (*MemoryManager) DeleteRule ¶
func (m *MemoryManager) DeleteRule(id string) error
func (*MemoryManager) ListRules ¶
func (m *MemoryManager) ListRules() ([]Rule, error)
func (*MemoryManager) UpdateRule ¶
func (m *MemoryManager) UpdateRule(rule *Rule) error
type Rule ¶
type Rule struct { // ID is the unique id of the rule. It can be at most 190 characters long, but the layout of the ID is up to you. // You will need this ID later on to update or delete the rule. ID string // MatchesMethods as an array of HTTP methods (e.g. GET, POST, PUT, DELETE, ...). When ORY Oathkeeper searches for rules // to decide what to do with an incoming request to the proxy server, it compares the HTTP method of the incoming // request with the HTTP methods of each rules. If a match is found, the rule is considered a partial match. MatchesMethods []string // MatchesURLCompiled is a regular expression of paths this rule matches. MatchesURLCompiled *regexp.Regexp // MatchesURL is a regular expression of paths this rule matches. MatchesURL string // RequiredScopes is a list of scopes that are required by this rule. RequiredScopes []string // RequiredScopes is the action this rule requires. RequiredAction string // RequiredScopes is the resource this rule requires. RequiredResource string // Mode is the mode this rule enforces. Mode string // Description describes the rule. Description string }
Rule is a single rule that will get checked on every HTTP request.
type SQLManager ¶
type SQLManager struct {
// contains filtered or unexported fields
}
func NewSQLManager ¶
func NewSQLManager(db *sqlx.DB) *SQLManager
func (*SQLManager) CreateRule ¶
func (s *SQLManager) CreateRule(rule *Rule) error
func (*SQLManager) CreateSchemas ¶
func (s *SQLManager) CreateSchemas() (int, error)
func (*SQLManager) DeleteRule ¶
func (s *SQLManager) DeleteRule(id string) error
func (*SQLManager) ListRules ¶
func (s *SQLManager) ListRules() ([]Rule, error)
func (*SQLManager) UpdateRule ¶
func (s *SQLManager) UpdateRule(rule *Rule) error