amber

package module
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: MIT Imports: 5 Imported by: 1

README

amber

Build Status codecov GitHub release (latest by date) MIT Licence GoDoc GitHub code size

Golang Kits for amber-login.

Documentation

Index

Constants

View Source
const CookieValueContextKey = "AmberCookieValue"

Variables

This section is empty.

Functions

func AuthAmber

func AuthAmber(handlerFunc http.HandlerFunc) http.HandlerFunc

func ServeCocsHandler added in v0.3.2

func ServeCocsHandler(writer http.ResponseWriter, request *http.Request)

Types

type Config

type Config struct {
	AppId         string
	EncryptKey    string
	CookieName    string
	AmberLoginUrl string
	LocalUrl      string
	ForceLogin    bool
}
var ConfigInstance *Config = nil

func NewConfig

func NewConfig(opts ...ConfigOption) *Config

type ConfigOption

type ConfigOption func(*ConfigOptions)

func WithAmberLoginUrl

func WithAmberLoginUrl(amberLoginUrl string) ConfigOption

func WithAppId

func WithAppId(appId string) ConfigOption

func WithCookieName

func WithCookieName(cookieName string) ConfigOption

func WithEncryptKey

func WithEncryptKey(encryptKey string) ConfigOption

func WithForceLogin

func WithForceLogin(forceLogin bool) ConfigOption

func WithLocalUrl

func WithLocalUrl(localUrl string) ConfigOption

type ConfigOptions

type ConfigOptions struct {
	AppId         string
	EncryptKey    string
	CookieName    string
	AmberLoginUrl string
	LocalUrl      string
	ForceLogin    bool
}

type CookieValue

type CookieValue struct {
	Username    string
	Random      string
	ExpiredTime time.Time
}

func ReadCookieValue

func ReadCookieValue(request *http.Request) (*CookieValue, error)

Jump to

Keyboard shortcuts

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