certauth

package module
v0.0.0-...-4d9adba Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2021 License: MIT Imports: 5 Imported by: 0

README

certauth

This package provides TLS certificate based authentication middleware. Only compatibile with httprouter.

Usage

Examples of usage with various http router libs in the ./examples directory. But they're broken right now.

Contributing

You can try, but probably better to just fork me like I did with this to start with. Unless you're very lucky, I'll probably ignore any pull requests or tickets.

Acknowledgments

Originally forked from https://github.com/pantheon-systems/go-certauth.

Their original acknowledgements:

A big thanks to the https://github.com/unrolled/secure project whose approach to writing middleware helped us figure out our approach to creating this project.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

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

Auth is an instance of the middleware

func NewAuth

func NewAuth(authHandler AuthHandler) *Auth

NewAuth returns an auth

func (*Auth) Process

func (a *Auth) Process(w http.ResponseWriter, r *http.Request, route string) (string, error)

Process is the main Entrypoint

func (*Auth) RouterHandler

func (a *Auth) RouterHandler(h httprouter.Handle) httprouter.Handle

func (*Auth) SetAuthErrorHandler

func (a *Auth) SetAuthErrorHandler(handler http.Handler)

func (*Auth) SetReqHeaderIdentifier

func (a *Auth) SetReqHeaderIdentifier(ident string)

func (*Auth) SetReqHeaders

func (a *Auth) SetReqHeaders(set bool)

func (*Auth) ValidateRequest

func (a *Auth) ValidateRequest(r *http.Request) error

ValidateRequest perfomrs verification on the TLS certs and chain

type AuthHandler

type AuthHandler interface {
	ValidateOU(ous []string, route string) (matched string, allowed bool)
	ValidateCN(cn, route string) (allowed bool)
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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