authentication

package
v0.1.2-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package authentication implements authentication mechanisms.

Key Transparency 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 (
	// E2EScope authorizes a user to change their keys in the keyserver.
	E2EScope = "https://www.googleapis.com/auth/e2ekeys"
	// RequiredScopes is the set of scopes the server requires for a user to change keys.
	RequiredScopes = []string{gAPI.UserinfoEmailScope, E2EScope}
)

Functions

func FakeAuthFunc

func FakeAuthFunc(ctx context.Context) (context.Context, error)

FakeAuthFunc implements go-grpc-middleware/auth.AuthFunc FakeAuthFunc looks for a fake authentication token and puts a SecurityContext in the returned ctx.

func GetFakeCredential

func GetFakeCredential(userID string) credentials.PerRPCCredentials

GetFakeCredential returns fake PerRPCCredentials

func WithOutgoingFakeAuth

func WithOutgoingFakeAuth(ctx context.Context, userID string) context.Context

WithOutgoingFakeAuth returns a ctx with FakeAuth information for userID.

Types

type GAuth

type GAuth struct {
	// contains filtered or unexported fields
}

GAuth authenticates Google users through the Google TokenInfo API endpoint.

func NewGoogleAuth

func NewGoogleAuth() (*GAuth, error)

NewGoogleAuth creates a new authenticator for Google users.

func (*GAuth) AuthFunc

func (a *GAuth) AuthFunc(ctx context.Context) (context.Context, error)

AuthFunc authenticate the information present in ctx.

type SecurityContext

type SecurityContext struct {
	Email string
}

SecurityContext is the auth value stored in the Contexts.

func FromContext

func FromContext(ctx context.Context) (*SecurityContext, bool)

FromContext returns a SecurityContext from the current context. ValidatedSecurity is inserted into ctx by AuthFunc.

Jump to

Keyboard shortcuts

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