oauth

package
v0.0.0-...-18a316a Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2017 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthHandler

func AuthHandler(cont *gin.Context)

AuthHandler handles authentication of a user and initiates a session.

func AuthorizeRequest

func AuthorizeRequest() gin.HandlerFunc

AuthorizeRequest is used to authorize a request for a certain end-point group.// {{{

func CORSMiddleware

func CORSMiddleware() gin.HandlerFunc

CORSMiddleware middleware witch headers for any RESTful requests// {{{

func FieldHandler

func FieldHandler(c *gin.Context)

FieldHandler is a rudementary handler for logged in users.

func LoginHandler

func LoginHandler(cont *gin.Context)

LoginHandler handles the login procedure.

func RandToken

func RandToken(length int) string

RandToken generates a random @length token.

func Start

func Start(args []string)

Types

type Config

type Config struct {
	Port    string
	Host    string
	KeyFile string
	Cred    Credentials
}

func (*Config) SetDefault

func (config *Config) SetDefault()

type Credentials

type Credentials struct {
	Cid     string `json:"cid"`
	Csecret string `json:"csecret"`
}

Credentials which stores google ids.

func (*Credentials) SetFromFile

func (cred *Credentials) SetFromFile(keyf string) *conf.ApiError

type GhostDB

type GhostDB struct {
	Users []User
}

func (*GhostDB) LoadUser

func (db *GhostDB) LoadUser(Email string) (user User, err error)

LoadUser get data from a user.// {{{

func (*GhostDB) PrintUsers

func (ghostDB *GhostDB) PrintUsers()

PrintUsers print all users// {{{

func (*GhostDB) SaveUser

func (db *GhostDB) SaveUser(user *User)

SaveUser register a user so we know that we saw that user already.// {{{

type Server

type Server struct{}

configure structurs

func (*Server) NewEngine

func (server *Server) NewEngine(port string)

NewEngine return the new gin server// {{{

type User

type User struct {
	ID       string `form:"id" binding:"required"`
	Username string `form:"name" binding:"required"`
	Email    string `form:"email" binding:"required"`
	Descr    string `form:"description" binding:"required"`
}

DviUser structure for all data for the user

func (*User) SetRnd

func (user *User) SetRnd()

SetRnd set random data to user// {{{

Jump to

Keyboard shortcuts

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