diff options
author | bnewbold <bnewbold@robocracy.org> | 2012-04-07 20:17:47 -0400 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2012-04-07 20:19:49 -0400 |
commit | 3c7a4451e62d27bbe9dc8eb2c16e2ff5607d1b04 (patch) | |
tree | cd488373455a7363d5d345672a007eaee8798070 /auth.go | |
parent | 6bbc3e9939e9e168e7cb0265f5d643b2d83943ae (diff) | |
download | bommom-3c7a4451e62d27bbe9dc8eb2c16e2ff5607d1b04.tar.gz bommom-3c7a4451e62d27bbe9dc8eb2c16e2ff5607d1b04.zip |
backup of partial progress
Diffstat (limited to 'auth.go')
-rw-r--r-- | auth.go | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -0,0 +1,40 @@ +package main + +// Authentication globals +var auth AuthService +var anonUser = &User{name: "common"} + +// Basic registered user account structure, for permissions etc. +type User struct { + // TODO: more specific types for these + name, pw, email string +} + +// Minimal requirements for an authentication backend. +type AuthService interface { + CheckLogin(name, pw string) error + NewAccount(name, pw, email string) error + ChangePassword(name, oldPw, newPw string) error + GetEmail(name string) (string, error) +} + +// DummyAuth is a "wide-open" implementation of AuthService for development and +// local use. Any username/password is accepted, and a dummy email address is +// always returned. +type DummyAuth bool // TODO: what is the best "dummy" abstract base type? + +func (da *DummyAuth) CheckLogin(name, pw string) error { + return nil +} + +func (da *DummyAuth) NewAccount(name, pw, email string) error { + return nil +} + +func (da *DummyAuth) ChangePassword(name, oldPw, newPw string) error { + return nil +} + +func (da *DummyAuth) GetEmail(name string) (string, error) { + return "example@bommom.com", nil +} |