session

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitRedisService

func InitRedisService(c *RedisConfig)

InitRedisService initializes the redis session service

func Login

func Login(r *http.Request, w http.ResponseWriter, u *User) error

Login logs the user in with the auth service that was initialized

func Logout

func Logout(r *http.Request, w http.ResponseWriter) error

Logout logs the user in with the auth service that was initialized

Types

type RedisConfig

type RedisConfig struct {
	Secure bool
}

RedisConfig is the redis session configuration

type Service

type Service interface {
	Login(r *http.Request, w http.ResponseWriter, u *User) error
	Logout(r *http.Request, w http.ResponseWriter) error
	GetUser(r *http.Request) (*User, error)
}

Service is an authentication service interface

type User

type User struct {
	Email     string `json:"email"`
	Username  string `json:"username"`
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
}

User is the user or robot making the request

func GetUser

func GetUser(r *http.Request) (*User, error)

GetUser logs the user in with the auth service that was initialized

Jump to

Keyboard shortcuts

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