From 0893f17eaf220cbe59be1f80526aef78d4429d6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Delattre?= Date: Fri, 10 Jun 2016 23:29:14 +0200 Subject: [PATCH] Fix typo: peeper => pepper --- auth/auth.go | 8 ++++---- auth/auth_test.go | 8 ++++---- config.yml.exemple | 2 +- config/canape.go | 2 +- main.go | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/auth/auth.go b/auth/auth.go index b081a1f..f621dd1 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -38,11 +38,11 @@ type Params struct { Backend UserBackend Cookiejar *sessions.CookieStore CookieName string - Peeper string + Pepper string Cost int } -// New Authorizer peeper is like a salt but not stored in database, +// New Authorizer pepper is like a salt but not stored in database, // cost is the bcrypt cost for hashing the password func New(params Params) *Authorizer { return &Authorizer{ @@ -52,7 +52,7 @@ func New(params Params) *Authorizer { // GenHash generates a new hash from a password func (a *Authorizer) GenHash(password string) (string, error) { - b, err := bcrypt.GenerateFromPassword([]byte(password+a.Peeper), a.Cost) + b, err := bcrypt.GenerateFromPassword([]byte(password+a.Pepper), a.Cost) if err != nil { return "", err } @@ -71,7 +71,7 @@ func (a *Authorizer) Login(rw http.ResponseWriter, req *http.Request, username, return err } - err = bcrypt.CompareHashAndPassword([]byte(u.GetHash()), []byte(password+a.Peeper)) + err = bcrypt.CompareHashAndPassword([]byte(u.GetHash()), []byte(password+a.Pepper)) if err != nil { return ErrInvalidPassword } diff --git a/auth/auth_test.go b/auth/auth_test.go index 6a5d08e..7a9c51c 100644 --- a/auth/auth_test.go +++ b/auth/auth_test.go @@ -13,7 +13,7 @@ import ( ) const ( - peeper = "polp" + pepper = "polp" ckey = "plop" cookieName = "auth" cost = 10 @@ -55,7 +55,7 @@ func getBackend() *Backend { } func login(w http.ResponseWriter, r *http.Request) { - a := New(getBackend(), peeper, cookieName, ckey, cost) + a := New(getBackend(), pepper, cookieName, ckey, cost) err := a.Login(w, r, username, password) if err != nil { fmt.Fprintf(w, "%s", err) @@ -66,7 +66,7 @@ func login(w http.ResponseWriter, r *http.Request) { } func logout(w http.ResponseWriter, r *http.Request) { - a := New(getBackend(), peeper, cookieName, ckey, cost) + a := New(getBackend(), pepper, cookieName, ckey, cost) err := a.Logout(w, r) if err != nil { fmt.Fprintf(w, "%s", err) @@ -76,7 +76,7 @@ func logout(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) } func check(w http.ResponseWriter, r *http.Request) { - a := New(getBackend(), peeper, cookieName, key, cost) + a := New(getBackend(), pepper, cookieName, key, cost) u, err := a.CurrentUser(w, r) if err != nil { w.WriteHeader(http.StatusInternalServerError) diff --git a/config.yml.exemple b/config.yml.exemple index 05e2870..533837f 100644 --- a/config.yml.exemple +++ b/config.yml.exemple @@ -1,7 +1,7 @@ authorizer: cookie_name: auth cookie_key: mysecretkey - peeper: peeper + pepper: pepper cost: 10 pgdsn: postgres://test:test@127.0.0.1:5432/dev?sslmode=disable trakttv_client_id: my_trakttv_client_id diff --git a/config/canape.go b/config/canape.go index 72b937a..f02f35f 100644 --- a/config/canape.go +++ b/config/canape.go @@ -17,7 +17,7 @@ type Config struct { type AuthorizerConfig struct { CookieName string `yaml:"cookie_name"` Key string `yaml:"cookie_key"` - Peeper string `yaml:"peeper"` + Pepper string `yaml:"pepper"` Cost int `yaml:"cost"` } diff --git a/main.go b/main.go index 44b1ff2..856aeda 100644 --- a/main.go +++ b/main.go @@ -39,7 +39,7 @@ func main() { authParams := auth.Params{ Backend: uBackend, - Peeper: cf.Authorizer.Peeper, + Pepper: cf.Authorizer.Pepper, CookieName: cf.Authorizer.CookieName, Cookiejar: sessions.NewCookieStore([]byte(cf.Authorizer.Key)), Cost: cf.Authorizer.Cost,