ttbauth

package module
v0.0.0-...-1ba5d4d Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: MIT Imports: 2 Imported by: 0

README

#+TiTLE: Tsatsubii Auth Common

* About
This repository contains code that is shared by Tsatsubii Auth server and 
client.

Documentation

Index

Constants

View Source
const (
	StatusOK               = 0
	StatusAuthFailed       = 1
	StatusAuthInactive     = 2
	StatusInvalidSession   = 3
	StatusPermissionDenied = 4

	StatusNew      = 1
	StatusActive   = 2
	StatusInactive = 3
	StatusDeleted  = 4

	ActionList   = 1
	ActionView   = 2
	ActionAdd    = 3
	ActionUpdate = 4
	ActionDelete = 5

	ErrInvalidStatus   = 1
	ErrInvalidUsername = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRequest

type AuthRequest struct {
	Username string `json:username`
	Password string `json:password`
}

type AuthResponse

type AuthResponse struct {
	Status  int       `json:status`
	Session uuid.UUID `json:session`
}

type LogoutRequest

type LogoutRequest struct {
	Session uuid.UUID `json:session`
}

type User

type User struct {
	Id        uuid.UUID `json:id`
	Username  string    `json:username`
	Password  string    `json:password`
	Status    int       `json:status`
	CreatedAt time.Time `json:created_at`
}

func (*User) Validate

func (user *User) Validate() (bool, []int)

func (*User) ValidateStatus

func (user *User) ValidateStatus() bool

func (*User) ValidateUsername

func (user *User) ValidateUsername() bool

type UserList

type UserList []UserListEntry

type UserListEntry

type UserListEntry struct {
	Id       uuid.UUID `json:id`
	Username string    `json:username`
	Status   int       `json:status`
}

type UserListResponse

type UserListResponse struct {
	Status int      `json:status`
	Data   UserList `json:data`
}

type UserRequest

type UserRequest struct {
	Session uuid.UUID `json:session`
	Action  int       `json:id`
	Data    []User
}

type UserResponse

type UserResponse struct {
	Status int   `json:status`
	Errors []int `json:errors`
	Data   User  `json:data`
}

Jump to

Keyboard shortcuts

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