Documentation
¶
Index ¶
- func GenerateAdminToken(admin string, session int) (string, error)
- func GenerateScopedToken(admin string, user, session int) (string, error)
- func GenerateUserToken(user, session int) (string, error)
- func GetAdmins() []string
- func IsAdmin(email string) bool
- func ParseAdminToken(token string) (string, int, error)
- func ParseScopedToken(token string) (string, int, int, error)
- func SetSecureStore(opts buffalo.Options) buffalo.Options
- func UserIP(c buffalo.Context) string
- type Environment
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateAdminToken ¶
GenerateAdminToken generates an unscoped token for an administrator
func GenerateScopedToken ¶
GenerateScopedToken generates a token for an administrator scoped to a user
func GenerateUserToken ¶
GenerateUserToken generates a token scoped to a user
func ParseAdminToken ¶
ParseAdminToken decodes the auth token given to it and ensures that it has administrator information in it
func ParseScopedToken ¶
ParseScopedToken decodes the auth token given to it and ensures that it is scoped to a user
func SetSecureStore ¶
SetSecureStore sets cookies as HTTPOnly and with the Secure bit on in any environment other than development and test. Most of it is ripped straight from the buffalo source code; https://github.com/gobuffalo/buffalo/blob/9f469851d4d4b00652bf49701840ad41037e6a93/options.go#L153-L162
Types ¶
type Environment ¶
type Environment string
Environment wraps the environment that's set
func GetEnvironment ¶
func GetEnvironment() Environment
GetEnvironment returns the current environment
func (Environment) IsDeployed ¶
func (e Environment) IsDeployed() bool
IsDeployed checks whether we're in a production deployed environment
func (Environment) Load ¶
func (e Environment) Load()
Load loads a dotenv file for the given environment