auth

package
Version: v0.0.0-...-3361740 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package auth provides authentication method

Index

Constants

View Source
const (
	Username string = "admin"
	Password string = "nimda"
)

Variables

This section is empty.

Functions

func GetAuthenticationHeader

func GetAuthenticationHeader(authentication Authentication, token string) string

func RegisterAuthentication

func RegisterAuthentication(name string, f AuthenticationFunc)

Types

type Authentication

type Authentication interface {

	// Name identify the system
	Name() string

	// Scheme used into the :authorization header
	Key() string

	// Credentials check username and password and returns a token
	Credentials(ctx context.Context, parentSpan opentracing.Span, username string, password string) (string, error)

	// Authenticate check the authentication challenge
	Authenticate(ctx context.Context, parentSpan opentracing.Span, token string) (map[string]string, error)
}

Authentication define an authentication system

func New

New returns a new authentication system using the name

type AuthenticationFunc

type AuthenticationFunc func(config *config.Configuration) (Authentication, error)

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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