backend

package
v0.0.0-...-9955711 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2014 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

*

  • This package provide types of authentication methods. *

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auther

type Auther interface {
	Auth(username string, password string, realm string) (bool, string)
	ValidateByUser(user *common.User) *common.AuthInfo
}

func New

func New(conf *Config) Auther

type Config

type Config struct {
	Key      string // JWT Secret
	Auth     string // Authentication method
	Username string // Username (for auth or db)
	Password string // Password (for auth or db)
	Host     string // database host
	Database string // database
	Expire   int    // Hours until token expire
}

type Postgres

type Postgres struct{}

func (*Postgres) Auth

func (p *Postgres) Auth(username string, password string, realm string) (bool, string)

Auths with postgresql database as back end

func (*Postgres) ValidateByUser

func (s *Postgres) ValidateByUser(user *common.User) *common.AuthInfo

type Simple

type Simple struct{}

func (*Simple) Auth

func (s *Simple) Auth(username string, password string, realm string) (bool, string)

Reads username and password from the configuration file

func (*Simple) ValidateByUser

func (s *Simple) ValidateByUser(user *common.User) *common.AuthInfo

Jump to

Keyboard shortcuts

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