osinserver

package
v1.2.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthorizePath = "/authorize"
	TokenPath     = "/token"
	InfoPath      = "/info"
)

Variables

This section is empty.

Functions

func NewDefaultServerConfig

func NewDefaultServerConfig() *osin.ServerConfig

Types

type AccessHandler

type AccessHandler interface {
	// HandleAccess populates an AccessRequest (typically the Authorized and UserData fields)
	HandleAccess(ar *osin.AccessRequest, w http.ResponseWriter) error
}

AccessHandler populates an AccessRequest

type AccessHandlerFunc

type AccessHandlerFunc func(ar *osin.AccessRequest, w http.ResponseWriter) error

func (AccessHandlerFunc) HandleAccess

type AccessHandlers

type AccessHandlers []AccessHandler

func (AccessHandlers) HandleAccess

func (all AccessHandlers) HandleAccess(ar *osin.AccessRequest, w http.ResponseWriter) error

type AuthorizeHandler

type AuthorizeHandler interface {
	// HandleAuthorize populates an AuthorizeRequest (typically the Authorized and UserData fields)
	// and returns false, or writes the response itself and returns true.
	HandleAuthorize(ar *osin.AuthorizeRequest, w http.ResponseWriter) (handled bool, err error)
}

AuthorizeHandler populates an AuthorizeRequest or handles the request itself

type AuthorizeHandlerFunc

type AuthorizeHandlerFunc func(ar *osin.AuthorizeRequest, w http.ResponseWriter) (bool, error)

func (AuthorizeHandlerFunc) HandleAuthorize

type AuthorizeHandlers

type AuthorizeHandlers []AuthorizeHandler

func (AuthorizeHandlers) HandleAuthorize

func (all AuthorizeHandlers) HandleAuthorize(ar *osin.AuthorizeRequest, w http.ResponseWriter) (bool, error)

type ErrorHandler added in v0.2.1

type ErrorHandler interface {
	// HandleError writes an error response
	HandleError(err error, w http.ResponseWriter, req *http.Request)
}

ErrorHandler writes an error response

func NewDefaultErrorHandler added in v0.2.1

func NewDefaultErrorHandler() ErrorHandler

NewDefaultErrorHandler returns a simple ErrorHandler

type Mux

type Mux interface {
	Handle(pattern string, handler http.Handler)
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
}

mux is an object that can register http handlers.

type Server

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

func New

func New(config *osin.ServerConfig, storage osin.Storage, authorize AuthorizeHandler, access AccessHandler, errorHandler ErrorHandler) *Server

func (*Server) AuthorizationHandler

func (s *Server) AuthorizationHandler() http.Handler

AuthorizationHandler returns an http.Handler capable of authorizing. Used for implicit authorization special flows.

func (*Server) Install

func (s *Server) Install(mux Mux, paths ...string)

Install registers the Server OAuth handlers into a mux. It is expected that the provided prefix will serve all operations

func (*Server) TokenHandler

func (s *Server) TokenHandler() http.Handler

TokenHandler returns an http.Handler capable of granting tokens. Used for implicit token granting special flows.

type TokenGen added in v0.5.2

type TokenGen struct {
}

TokenGen is an authorization and access token generator

func (TokenGen) GenerateAccessToken added in v0.5.2

func (TokenGen) GenerateAccessToken(data *osin.AccessData, generaterefresh bool) (string, string, error)

GenerateAccessToken generates random UUID access and refresh tokens

func (TokenGen) GenerateAuthorizeToken added in v0.5.2

func (TokenGen) GenerateAuthorizeToken(data *osin.AuthorizeData) (ret string, err error)

GenerateAuthorizeToken generates a random UUID code

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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