auth

package
v0.0.0-...-ad489cb Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2015 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Authentication utilities for GoPics.

Copyright (c) 2015, Luca Chiricozzi. All rights reserved. Released under the MIT License. http://opensource.org/licenses/MIT

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelCookie

func DelCookie(w http.ResponseWriter)

DelCookie removes the authentication cookie.

func GetCookie

func GetCookie(r *http.Request, k Keyring) (value string, err error)

GetCookie reads the authentication cookie from a request and returns the authentication credentials in the cookie

func SetCookie

func SetCookie(w http.ResponseWriter, k Keyring, value string) error

SetCookie creates a new authentication cookie.

Types

type Keyring

type Keyring struct {
	*securecookie.SecureCookie
}

A Keyring is used to encrypt and decrypt auth cookies.

func NewKeyring

func NewKeyring(hashKey, blockKey []byte) Keyring

NewKeyring creates a new Keyring with the given hashKey and blockKey. The hashKey is required, it has a length of 32 or 64 bytes. The blockKey is optional, it has a length of 16, 24 or 32 bytes.

Jump to

Keyboard shortcuts

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