commonbuilder

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

An example of how to use the Authz plugin with the common builder pattern.

$ go run examples/authz/main.go -example=common-builder

At time of writing there is no web UI to exercise the endpoints, so you'll need to use CURL (or equivalent). Use the following commands to try things out:

Get an access token for a specific user using email/password:

curl 'http://localhost:8000/api/auth/login?provider=password&creds%5Bemail%5D=logan@xmen.net&creds%5Bpassword%5D=password&issue_token=true'

Save the token in an environment variable:

export AT='...'

List documents:

curl -H "Authorization: bearer $AT" http://localhost:8000/api/xmen/docs

View a document:

curl -H "Authorization: bearer $AT" http://localhost:8000/api/xmen/docs/3

Save a document:

curl -X PUT -d '{"title": "new title", "body": "new body"}' -H"Authorization: bearer $AT" -H"X-CSRF-Protection: 1" http://localhost:8000/api/xmen/docs/3

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run()

Run starts the builder example server

Types

This section is empty.

Jump to

Keyboard shortcuts

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