authenticator

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2020 License: MIT Imports: 7 Imported by: 0

README

authenticator GoDoc

Package authenticator provides allows to authorize request

Download:

go get -u github.com/vardius/go-api-boilerplate/pkg/http/middleware/authenticator

Package authenticator provides allows to authorize request

Documentation

Overview

Package authenticator provides allows to authorize request

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CredentialsAuthFunc

type CredentialsAuthFunc func(username, password string) (identity.Identity, error)

CredentialsAuthFunc returns Identity from username and password combination

type CredentialsAuthenticator

type CredentialsAuthenticator interface {
	// FromBasicAuth authorize by the username and password provided in the request's
	// Authorization header, if the request uses HTTP Basic Authentication.
	FromBasicAuth(name string) func(next http.Handler) http.Handler
}

CredentialsAuthenticator authorize by the username and password and adds Identity to request's Context

func NewCredentials

NewCredentials returns new credentials authenticator

type TokenAuthFunc

type TokenAuthFunc func(token string) (identity.Identity, error)

TokenAuthFunc returns Identity from token

type TokenAuthenticator

type TokenAuthenticator interface {
	// FromHeader authorize by the token provided in the request's Authorization header
	FromHeader(realm string) func(next http.Handler) http.Handler
	// FromQuery authorize by the token provided in the request's query parameter
	FromQuery(name string) func(next http.Handler) http.Handler
	// FromCookie authorize by the token provided in the request's cookie
	FromCookie(name string) func(next http.Handler) http.Handler
}

TokenAuthenticator authorize by token and adds Identity to request's Context

func NewToken

func NewToken(afn TokenAuthFunc) TokenAuthenticator

NewToken returns new token authenticator

Jump to

Keyboard shortcuts

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