authentication

package
v0.0.0-...-02c3ccb Latest Latest
Warning

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

Go to latest
Published: May 22, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package authentication implements authentication mechanisms.

The Transparent Key Server is designed to be used by identity providers - IdP in OAuth parlance. OAuth2 Access Tokens may be provided as authentication information, which can be resolved to user information and associated scopes on the backend.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingAuth occurs when authentication information is missing.
	ErrMissingAuth = errors.New("auth: missing authentication header")
	// ErrWrongUser occurs when the authenticated user does not match the owner of the requested resource.
	ErrWrongUser = errors.New("auth: email missmatch")
)

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	// ValidateCreds verifies that the requiredUserID, and any other
	// required authentication information is present in ctx.
	ValidateCreds(ctx context.Context, requiredUserID string) error
}

Authenticator provides services to authenticate users.

type FakeAuth

type FakeAuth struct{}

FakeAuth provides a fake authenticator for testing.

func NewFake

func NewFake() *FakeAuth

NewFake returns a new authenticator.

func (*FakeAuth) NewContext

func (a *FakeAuth) NewContext(userID string) context.Context

NewContext adds authentication details to a new background context.

func (*FakeAuth) ValidateCreds

func (a *FakeAuth) ValidateCreds(ctx context.Context, requiredUserID string) error

ValidateCreds verifies that the requiredUserID is present in ctx.

Jump to

Keyboard shortcuts

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