utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2018 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrKeyGen = "key generation error"
	ErrPubKey = "public Key marshalling error"
)

constants for error code

Variables

This section is empty.

Functions

func DOOPS

func DOOPS(c buffalo.Context, form string, data ...interface{}) error

DOOPS make a log for database error and return redirect.

form: format of the log message
data...: arguments for log message

func GenRSAKeyPair

func GenRSAKeyPair() (*rsa.PrivateKey, []byte, error)

GenRSAKeyPair generates and returns RSA private key, public pem with error

func GetIntParam

func GetIntParam(c buffalo.Context, key string, min, max int) (i int)

GetIntParam extracts and returns an integer value from request parameter. if the parameter is not exist or smaller than min or larger than max, it returns min value.

func GetParam

func GetParam(c buffalo.Context, key string) interface{}

GetParam returns string or integer based on the value.

func GetStringParam

func GetStringParam(c buffalo.Context, key, failback string) (val string)

GetStringParam extracts and returns a string value from request parameter. if the parameter is not exist, it returns failback value.

func InvalidAccess

func InvalidAccess(c buffalo.Context, url, form string, data ...interface{}) error

InvalidAccess make a log for system error and return redirect

url: url redirect to
form: format of the log message
data...: arguments for log message

func NewRS256AccessTokenGen

func NewRS256AccessTokenGen(issuer, key string) osin.AccessTokenGen

NewRS256AccessTokenGen returns RS256AccessTokenGen as osin.AccessTokenGen

func OOPS

func OOPS(c buffalo.Context, ec int, url, dom, form string, data ...interface{}) error

OOPS is a common error log and redirector.

func SOOPS

func SOOPS(c buffalo.Context, form string, data ...interface{}) error

SOOPS make a log for system error and return redirect

form: format of the log message
data...: arguments for log message

func UARTAdmins

func UARTAdmins(tx *pop.Connection) *models.Members

UARTAdmins returns registered administrators of UART app.

Types

type RS256AccessTokenGen

type RS256AccessTokenGen struct {
	Issuer     string
	PrivateKey *rsa.PrivateKey
}

RS256AccessTokenGen is JWT access token generator

func (RS256AccessTokenGen) GenerateAccessToken

func (g RS256AccessTokenGen) GenerateAccessToken(data *osin.AccessData, refresh bool) (string, string, error)

GenerateAccessToken implementation for JWT

Jump to

Keyboard shortcuts

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