tokeninfo

package
v0.0.0-...-22bf50c Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidRequest should be used whenever the receiver failed to parse the request
	ErrInvalidRequest = Error{"invalid_request", "Access Token not valid", http.StatusBadRequest}
	// ErrInvalidToken should be used whenever the receiver failed to validate a JWT Token
	ErrInvalidToken = Error{"invalid_token", "Access Token not valid", http.StatusUnauthorized}
)

Functions

func AccessTokenFromRequest

func AccessTokenFromRequest(req *http.Request) string

AccessTokenFromRequest can be used to extract an Access Token from an http.Request via the standard headers/parameters

Ref:
    https://tools.ietf.org/html/rfc6749#section-5.1
    https://tools.ietf.org/html/rfc6750#section-2.1

func NewHandler

func NewHandler(def http.Handler, r ...Handler) http.Handler

NewHandler returns an http.Handler that contains a default http.Handler and a variadic argument of TokenInfoHandlers that will selectively handle specific requests

Types

type Error

type Error struct {
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
	// contains filtered or unexported fields
}

Error type is used to wrap standard error messages that can be easily marshaled to JSON

func (*Error) Write

func (e *Error) Write(w http.ResponseWriter)

Write will write the Error e to the response writer, marshaled as JSON, and with the respective Status Code

type Handler

type Handler interface {
	http.Handler
	Match(r *http.Request) bool
}

A Handler is a regular http.Handler that can be queried for its capacity of handling a Request. The Match function should be as fast as possible verifying if the Request matches

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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