app

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2018 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CookieKeySession       = "mokey-sessck"
	CookieKeyAuthenticated = "authenticated"
	CookieKeySID           = "sid"
	CookieKeyUser          = "user"
	CookieKeyWYAF          = "wyaf"
	ContextKeyUser         = "user"
	ContextKeyApi          = "apikey"
	CSRFFieldName          = "auth_tok"
	TokenRegex             = `[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\-\_\.]+`
	ResetSalt              = "resetpw"
	AccountSetupSalt       = "acctsetup"
)

Variables

This section is empty.

Functions

func NewIpaClient

func NewIpaClient(withKeytab bool) *ipa.Client

Types

type ApiKeyClient added in v0.0.6

type ApiKeyClient struct {
	Name        string
	ClientID    string `mapstructure:"client_id"`
	Description string `mapstructure:"desc"`
	Scopes      string
}

type AppContext

type AppContext struct {
	DB          *sqlx.DB
	HydraClient *sdk.Client
	ApiClients  map[string]*ApiKeyClient
	Tmpldir     string
	// contains filtered or unexported fields
}

func NewAppContext

func NewAppContext() (*AppContext, error)

func (*AppContext) GetSession

func (app *AppContext) GetSession(r *http.Request) (*sessions.Session, error)

Get the session

func (*AppContext) GetUser

func (app *AppContext) GetUser(r *http.Request) *ipa.UserRecord

Get the user from the request context

func (*AppContext) GetWYAF added in v0.0.6

func (app *AppContext) GetWYAF(session *sessions.Session) string

Get WYAF from session

func (*AppContext) RenderError

func (app *AppContext) RenderError(w http.ResponseWriter, status int)

Render error template and write HTTP status

func (*AppContext) RenderNotFound

func (app *AppContext) RenderNotFound(w http.ResponseWriter)

Render 404 template

func (*AppContext) RenderTemplate

func (app *AppContext) RenderTemplate(w http.ResponseWriter, name string, data map[string]interface{})

Render template t using template parameters in data.

func (*AppContext) SendEmail

func (a *AppContext) SendEmail(email, subject, template string, data map[string]interface{}) error

Jump to

Keyboard shortcuts

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