authz

command
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

An example of how to use the Authz plugin.

$ go run examples/authzs/authzexample.go

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

Jump to

Keyboard shortcuts

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