Documentation ¶
Index ¶
- Constants
- func TestHelperManagers(m Manager) func(t *testing.T)
- type Group
- type Handler
- func (h *Handler) AddGroupMembers(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (h *Handler) CreateGroup(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (h *Handler) DeleteGroup(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (h *Handler) FindGroupNames(w http.ResponseWriter, r *http.Request, member string, limit, offset int)
- func (h *Handler) GetGroup(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (h *Handler) ListGroups(w http.ResponseWriter, r *http.Request, limit, offset int)
- func (h *Handler) ListGroupsHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (h *Handler) PrefixResource(resource string) string
- func (h *Handler) RemoveGroupMembers(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (h *Handler) SetRoutes(r *httprouter.Router)
- type Manager
- type MemoryManager
- func (m *MemoryManager) AddGroupMembers(group string, subjects []string) error
- func (m *MemoryManager) CreateGroup(g *Group) error
- func (m *MemoryManager) DeleteGroup(id string) error
- func (m *MemoryManager) FindGroupsByMember(subject string, limit, offset int) ([]Group, error)
- func (m *MemoryManager) GetGroup(id string) (*Group, error)
- func (m *MemoryManager) ListGroups(limit, offset int) ([]Group, error)
- func (m *MemoryManager) RemoveGroupMembers(group string, subjects []string) error
- type SQLManager
- func (m *SQLManager) AddGroupMembers(group string, subjects []string) error
- func (m *SQLManager) CreateGroup(g *Group) error
- func (m *SQLManager) CreateSchemas() (int, error)
- func (m *SQLManager) DeleteGroup(id string) error
- func (m *SQLManager) FindGroupsByMember(subject string, limit, offset int) ([]Group, error)
- func (m *SQLManager) GetGroup(id string) (*Group, error)
- func (m *SQLManager) ListGroups(limit, offset int) ([]Group, error)
- func (m *SQLManager) RemoveGroupMembers(group string, subjects []string) error
Constants ¶
const ( GroupsResource = "warden:groups" GroupResource = "warden:groups:%s" Scope = "hydra.warden.groups" )
const (
GroupsHandlerPath = "/warden/groups"
)
Variables ¶
This section is empty.
Functions ¶
func TestHelperManagers ¶ added in v0.9.3
Types ¶
type Group ¶
type Group struct { // ID is the groups id. ID string `json:"id"` // Members is who belongs to the group. Members []string `json:"members"` }
Group represents a warden group
swagger:model group
type Handler ¶
func (*Handler) AddGroupMembers ¶
func (h *Handler) AddGroupMembers(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
swagger:route POST /warden/groups/{id}/members warden addMembersToGroup
Add members to a group ¶
The subject making the request needs to be assigned to a policy containing:
``` { "resources": ["rn:hydra:warden:groups:<id>"], "actions": ["members.add"], "effect": "allow" } ``` Consumes: - application/json Produces: - application/json Schemes: http, https Security: oauth2: hydra.warden.groups Responses: 204: emptyResponse 401: genericError 403: genericError 500: genericError
func (*Handler) CreateGroup ¶
func (h *Handler) CreateGroup(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
swagger:route POST /warden/groups warden createGroup
Create a group ¶
The subject making the request needs to be assigned to a policy containing:
``` { "resources": ["rn:hydra:warden:groups"], "actions": ["create"], "effect": "allow" } ``` Consumes: - application/json Produces: - application/json Schemes: http, https Security: oauth2: hydra.warden.groups Responses: 201: groupResponse 401: genericError 403: genericError 500: genericError
func (*Handler) DeleteGroup ¶
func (h *Handler) DeleteGroup(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
swagger:route DELETE /warden/groups/{id} warden deleteGroup
Delete a group by id ¶
The subject making the request needs to be assigned to a policy containing:
``` { "resources": ["rn:hydra:warden:groups:<id>"], "actions": ["delete"], "effect": "allow" } ``` Consumes: - application/json Produces: - application/json Schemes: http, https Security: oauth2: hydra.warden.groups Responses: 204: emptyResponse 401: genericError 403: genericError 500: genericError
func (*Handler) FindGroupNames ¶
func (*Handler) GetGroup ¶
func (h *Handler) GetGroup(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
swagger:route GET /warden/groups/{id} warden getGroup
Get a group by id ¶
The subject making the request needs to be assigned to a policy containing:
``` { "resources": ["rn:hydra:warden:groups:<id>"], "actions": ["create"], "effect": "allow" } ``` Consumes: - application/json Produces: - application/json Schemes: http, https Security: oauth2: hydra.warden.groups Responses: 201: groupResponse 401: genericError 403: genericError 500: genericError
func (*Handler) ListGroups ¶ added in v0.11.0
func (*Handler) ListGroupsHandler ¶ added in v0.11.0
func (h *Handler) ListGroupsHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
swagger:route GET /warden/groups warden listGroups
List groups ¶
The subject making the request needs to be assigned to a policy containing:
``` { "resources": ["rn:hydra:warden:groups"], "actions": ["list"], "effect": "allow" } ``` Consumes: - application/json Produces: - application/json Schemes: http, https Security: oauth2: hydra.warden.groups Responses: 200: listGroupsResponse 401: genericError 403: genericError 500: genericError
func (*Handler) PrefixResource ¶ added in v0.10.0
func (*Handler) RemoveGroupMembers ¶
func (h *Handler) RemoveGroupMembers(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
swagger:route DELETE /warden/groups/{id}/members warden removeMembersFromGroup
Remove members from a group ¶
The subject making the request needs to be assigned to a policy containing:
``` { "resources": ["rn:hydra:warden:groups:<id>"], "actions": ["members.remove"], "effect": "allow" } ``` Consumes: - application/json Produces: - application/json Schemes: http, https Security: oauth2: hydra.warden.groups Responses: 204: emptyResponse 401: genericError 403: genericError 500: genericError
func (*Handler) SetRoutes ¶
func (h *Handler) SetRoutes(r *httprouter.Router)
type Manager ¶
type Manager interface { CreateGroup(*Group) error GetGroup(id string) (*Group, error) DeleteGroup(id string) error AddGroupMembers(group string, members []string) error RemoveGroupMembers(group string, members []string) error FindGroupsByMember(subject string, limit, offset int) ([]Group, error) ListGroups(limit, offset int) ([]Group, error) }
type MemoryManager ¶
func NewMemoryManager ¶
func NewMemoryManager() *MemoryManager
func (*MemoryManager) AddGroupMembers ¶
func (m *MemoryManager) AddGroupMembers(group string, subjects []string) error
func (*MemoryManager) CreateGroup ¶
func (m *MemoryManager) CreateGroup(g *Group) error
func (*MemoryManager) DeleteGroup ¶
func (m *MemoryManager) DeleteGroup(id string) error
func (*MemoryManager) FindGroupsByMember ¶ added in v0.9.14
func (m *MemoryManager) FindGroupsByMember(subject string, limit, offset int) ([]Group, error)
func (*MemoryManager) ListGroups ¶ added in v0.9.16
func (m *MemoryManager) ListGroups(limit, offset int) ([]Group, error)
func (*MemoryManager) RemoveGroupMembers ¶
func (m *MemoryManager) RemoveGroupMembers(group string, subjects []string) error
type SQLManager ¶
func (*SQLManager) AddGroupMembers ¶
func (m *SQLManager) AddGroupMembers(group string, subjects []string) error
func (*SQLManager) CreateGroup ¶
func (m *SQLManager) CreateGroup(g *Group) error
func (*SQLManager) CreateSchemas ¶
func (m *SQLManager) CreateSchemas() (int, error)
func (*SQLManager) DeleteGroup ¶
func (m *SQLManager) DeleteGroup(id string) error
func (*SQLManager) FindGroupsByMember ¶ added in v0.9.14
func (m *SQLManager) FindGroupsByMember(subject string, limit, offset int) ([]Group, error)
func (*SQLManager) ListGroups ¶ added in v0.9.16
func (m *SQLManager) ListGroups(limit, offset int) ([]Group, error)
func (*SQLManager) RemoveGroupMembers ¶
func (m *SQLManager) RemoveGroupMembers(group string, subjects []string) error