transportGin

package
v0.0.0-...-dd0c161 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindJSON

func BindJSON(obj interface{}, c *gin.Context) error

BindJSON is a shortcut for c.BindWith(obj, binding.JSON)

func BindWith

func BindWith(obj interface{}, b binding.Binding, c *gin.Context) error

BindWith binds the passed struct pointer using the specified binding engine. See the binding package.

Types

type Connector

type Connector struct {
	Waechter              *waechter.Waechter
	Debug                 bool
	AuthPath              string
	Domain                string
	Writer                io.Writer
	ForceHTTPS            bool
	RedirectVerifySuccess string
	RedirectVerifyFailed  string
}

Connector is used to setup gin with go-waechter

func (*Connector) CheckAccessToken

func (connector *Connector) CheckAccessToken(target string, context *gin.Context) (*jwt.StandardClaims, *waechter.AuthError)

func (*Connector) CreateAccessToken

func (connector *Connector) CreateAccessToken(target string, path string, claims *jwt.StandardClaims, expires time.Duration, context *gin.Context) *waechter.AuthError

func (*Connector) DefaultRoutes

func (connector *Connector) DefaultRoutes(engine *gin.Engine)

DefaultRoutes mounts routes under the /auth/ path

func (*Connector) Enforce

func (connector *Connector) Enforce(target string, path string, c *gin.Context, verify VerifyFunc, handle HandleFunc)

Enfore enforces a permission on a route

func (*Connector) ForgotPassword

func (connector *Connector) ForgotPassword(context *gin.Context)

ForgotPassword requests a reset password email

func (*Connector) GetAccessToken

func (connector *Connector) GetAccessToken(target string, context *gin.Context) (string, *waechter.AuthError)

func (*Connector) GetRefreshToken

func (connector *Connector) GetRefreshToken(context *gin.Context) (*waechter.User, *jwt.StandardClaims, error)

func (*Connector) LoginEmail

func (connector *Connector) LoginEmail(context *gin.Context)

LoginEmail ...

func (*Connector) LoginUsername

func (connector *Connector) LoginUsername(context *gin.Context)

LoginUsername ...

func (*Connector) LoginUsernameOrEmail

func (connector *Connector) LoginUsernameOrEmail(context *gin.Context)

LoginUsernameOrEmail ...

func (*Connector) Register

func (connector *Connector) Register(context *gin.Context)

Register a new account

func (*Connector) RequestVerification

func (connector *Connector) RequestVerification(context *gin.Context)

RequestVerification ...

func (*Connector) ResetPassword

func (connector *Connector) ResetPassword(context *gin.Context)

ResetPassword resets the password of a user

func (*Connector) VerifyEmail

func (connector *Connector) VerifyEmail(context *gin.Context)

VerifyEmail of a new account

type HandleFunc

type HandleFunc func(claims *jwt.StandardClaims, userId string)

type JSONResponse

type JSONResponse struct {
	Status bool                `json:"status"`
	Err    *waechter.AuthError `json:"err"`
	Data   interface{}         `json:"data"`
}

JSONResponse describes the format in which data is returned from the connector

type VerifyFunc

type VerifyFunc func(claims *jwt.StandardClaims, user *waechter.User) (bool, time.Duration)

Jump to

Keyboard shortcuts

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