auth

package
v0.0.0-...-97a7976 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetToken

func GetToken(role *Role, username string) (string, error)

GetToken returns a string that contain the token

func GetTokenFromContext

func GetTokenFromContext(r *http.Request) *jwt.Token

GetTokenFromContext retrieves the JWT Token from the request

Types

type Config

type Config struct {
	Auth       structs.Auth
	DriverFn   loginFn
	DriverName string
}

Config struct contains the authentication configuration

func New

func New(auth structs.Auth) Config

New function initalizes and returns a Config struct

func (*Config) Advanced

func (a *Config) Advanced(driver loginFn, driverName string)

Advanced function allows a third party Identification driver

func (*Config) Authenticate

func (a *Config) Authenticate(next http.Handler) http.Handler

Authenticate calls the proper handler based on whether authentication is enabled or not

func (*Config) GetIdentification

func (a *Config) GetIdentification() http.Handler

GetIdentification retrieves the user & pass from a POST and authenticates the user against the Identification driver

func (*Config) None

func (a *Config) None()

None function sets the Config struct in order to disable authentication

func (*Config) Simple

func (a *Config) Simple(u []User)

Simple function sets the Config struct in order to enable simple authentication based on provided user and pass

type Role

type Role struct {
	Datacenters   []string
	Fallback      bool
	Members       []string
	Name          string
	Readonly      bool
	Subscriptions []string
}

Role contains the roles of each GitHub team

type User

type User struct {
	ID           int64
	Username     string
	FullName     string
	Email        string
	Password     string
	PasswordHash string
	PasswordSalt string
	Role         Role
	Token        string
}

User structure

Jump to

Keyboard shortcuts

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