oidcauth

package
v0.0.0-...-3ed2260 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2017 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const Identity = "identity"

Identity is a constant for grpc metadata

Variables

This section is empty.

Functions

func EmailLoggingClosure

func EmailLoggingClosure(r *http.Request) []zapcore.Field

EmailLoggingClosure adds a "user" field for an authorized user

func EnsureValidTokens

func EnsureValidTokens(manager *AuthManager, idToken, accessToken, refreshToken string) (string, string, string, error)

EnsureValidTokens ensures a given id, access, and refresh token are valid and refreshed

func FromContext

func FromContext(ctx context.Context) (string, bool)

FromContext returns the Email value stored in ctx, if any.

func NewContext

func NewContext(ctx context.Context, email string) context.Context

NewContext returns a new Context that carries value email.

func OidcEmailContext

func OidcEmailContext(issuerURL, clientID string) middlewares.Middleware

OidcEmailContext is a middlware for embedding a Email in the request's context

func Setup

func Setup() error

Setup ensures the user has a valid id token for OIDC requests

func StreamHeaderInterceptor

func StreamHeaderInterceptor(headers map[string]string) grpc.StreamClientInterceptor

StreamHeaderInterceptor adds key value pairs as headers

func UnaryHeaderInterceptor

func UnaryHeaderInterceptor(headers map[string]string) grpc.UnaryClientInterceptor

UnaryHeaderInterceptor adds key value pairs as headers

func ValidateIDToken

func ValidateIDToken(clientID, issuerURL string) grpc_auth.AuthFunc

ValidateIDToken returns a grpc_auth.AuthFunc for verifying OIDC requests

Types

type AuthManager

type AuthManager struct {
	Config   *oauth2.Config
	Provider *oidc.Provider
	Verifier *oidc.IDTokenVerifier
}

AuthManager is a convienence struct for caching an oidc Provider and IDTokenVerifier

func NewManager

func NewManager(ctx context.Context, clientID, clientSecret string) (*AuthManager, error)

NewManager returns a new AuthManager for the given client id/secret

Jump to

Keyboard shortcuts

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