authentication

package
v0.0.0-...-8bb3452 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package authentication challenges user credentials and creates or destroys cookie based sessions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CsrfToken

func CsrfToken(w http.ResponseWriter, r *http.Request)

CsrfToken will generate a CSRF Token

func Login

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

Login gets a new session for the user if the credential check passes

func Logout

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

Logout destroys the session

Types

type Credentials

type Credentials struct {
	Email, Password string
}

Credentials are the user provided email and password

func DecodeCredentials

func DecodeCredentials(r *http.Request) (c Credentials)

DecodeCredentials decodes the JSON data into a struct containing the email and password.DecodeCredentials

Jump to

Keyboard shortcuts

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