general-api

command module
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2018 License: BSD-3-Clause Imports: 10 Imported by: 0

README

License GitHub version

General authentication API

Execute authentication and authorization with JSON Request and Response.

Getting Started

Prerequisites

Installed the following program.

  • Golang 1.8+

Installing

  • Get dep binary (dep is Golang's package manager)
$ go get -u github.com/golang/dep/cmd/dep
$
$ cd <repository_root>
$ dep ensure

Build & Run

$ cd <repository_root>
$ cp config.json.example config.json # with editing
$
$ GOOS=<target_os> GOARCH=<target_arch> go build -o auth-api
$ ./auth-api

Endpoint

Endpoint Method Required token Description
/ GET Get application states
/users GET O Get account data
/users POST Execute account registration (and issue a temporary password)
/activate POST Enabled account (and change password)
/auth POST O Execute authentication
/deauth DELETE O Execute deauthentication

Usage

  • Example with /auth
Request
  • HTTP Header
    • Content-Type: application/json
{
  "account": "test",
  "password": "password"
}
Response
{
  "id": 1,
  "accessToken": "[Access Token]",
  "environment": "debug"
}
  • Example at /users
Request
  • HTTP Header
    • Content-Type: application/json
    • Authorization: Bearer [Access Token]
Response
{
  "id": 1,
  "account": "test",
  "name": "Test User",
  "sex": "Male",
  "mailAddress": "test@example.com",
  "role": "Administrator"
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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