oauth

package
v0.0.0-...-4faa3c3 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// GrantTypeClientCredentials represents a client credential grant type
	GrantTypeClientCredentials = "client_credentials"

	// GrantTypeAuthorizationCode represets an authorization grant type
	GrantTypeAuthorizationCode = "authorization_code"

	// SigningSecret is the secret used to create oauth tokens
	SigningSecret = os.Getenv("AUTH_SECRET")

	// TokenTypeApp is the name of an app token
	TokenTypeApp = "app"
)

Functions

func MakeToken

func MakeToken(secret string, claims map[string]interface{}) (string, error)

MakeToken creates an HMAC token

Types

type OAuth

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

OAuth implements all the OAuth2 requirements of the application

func NewOAuth

func NewOAuth(db patchain.DB) *OAuth

NewOAuth creates a new OAuth instance

func (*OAuth) GetToken

func (o *OAuth) GetToken(w http.ResponseWriter, r *http.Request) (interface{}, int)

GetToken returns a token

Jump to

Keyboard shortcuts

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