policy

package
v0.11.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PolicyHandlerPath = "/policies"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	Manager        ladon.Manager
	H              herodot.Writer
	W              firewall.Firewall
	ResourcePrefix string
}

func (*Handler) Create

func (h *Handler) Create(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

swagger:route POST /policies policy createPolicy

Create an Access Control Policy

The subject making the request needs to be assigned to a policy containing:

```
{
  "resources": ["rn:hydra:policies"],
  "actions": ["create"],
  "effect": "allow"
}
```

   Consumes:
   - application/json

   Produces:
   - application/json

   Schemes: http, https

   Security:
     oauth2: hydra.policies

   Responses:
     201: policy
     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 /policies/{id} policy deletePolicy

Delete an Access Control Policy

The subject making the request needs to be assigned to a policy containing:

```
{
  "resources": ["rn:hydra:policies:<id>"],
  "actions": ["delete"],
  "effect": "allow"
}
```

   Consumes:
   - application/json

   Produces:
   - application/json

   Schemes: http, https

   Security:
     oauth2: hydra.policies

   Responses:
     204: emptyResponse
     401: genericError
     403: genericError
     500: genericError

func (*Handler) Get

swagger:route GET /policies/{id} policy getPolicy

Get an Access Control Policy

The subject making the request needs to be assigned to a policy containing:

```
{
  "resources": ["rn:hydra:policies:<id>"],
  "actions": ["get"],
  "effect": "allow"
}
```

   Consumes:
   - application/json

   Produces:
   - application/json

   Schemes: http, https

   Security:
     oauth2: hydra.policies

   Responses:
     200: policy
     401: genericError
     403: genericError
     500: genericError

func (*Handler) List added in v0.8.0

swagger:route GET /policies policy listPolicies

List Access Control Policies

The subject making the request needs to be assigned to a policy containing:

```
{
  "resources": ["rn:hydra:policies"],
  "actions": ["list"],
  "effect": "allow"
}
```

   Consumes:
   - application/json

   Produces:
   - application/json

   Schemes: http, https

   Security:
     oauth2: hydra.policies

   Responses:
     200: policyList
     401: genericError
     403: genericError
     500: genericError

func (*Handler) PrefixResource added in v0.10.0

func (h *Handler) PrefixResource(resource string) string

func (*Handler) SetRoutes

func (h *Handler) SetRoutes(r *httprouter.Router)

func (*Handler) Update added in v0.7.0

func (h *Handler) Update(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

swagger:route PUT /policies/{id} policy updatePolicy

Update an Access Control Polic

The subject making the request needs to be assigned to a policy containing:

```
{
  "resources": ["rn:hydra:policies"],
  "actions": ["update"],
  "effect": "allow"
}
```

   Consumes:
   - application/json

   Produces:
   - application/json

   Schemes: http, https

   Security:
     oauth2: hydra.policies

   Responses:
     200: policy
     401: genericError
     403: genericError
     500: genericError

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL