auth
auth/client/login.go
Use an environment variable to set the JWT secret. When setting up the authd server, populate the JWT secret using a JWT_SECRET environment variable. Incidentally, we also included the subscriptions scope, for testing purposes while creating code.secondbit.org/ducky/subscriptions. We now also log the port we're listening on, listen on all interfaces (instead of just 127.0.0.1), and changed the port to 9000 instead of 8080.
| paddy@172 | 1 package client |
| paddy@172 | 2 |
| paddy@172 | 3 import ( |
| paddy@172 | 4 "code.secondbit.org/auth.hg" |
| paddy@172 | 5 ) |
| paddy@172 | 6 |
| paddy@172 | 7 func (c *Client) GetLogin(value string) (auth.Login, error) { |
| paddy@173 | 8 resp, err := c.Get("/logins/"+value, auth.Scopes{auth.ScopeLoginAdmin}.Strings(), nil) |
| paddy@172 | 9 if err != nil { |
| paddy@172 | 10 return auth.Login{}, err |
| paddy@172 | 11 } |
| paddy@172 | 12 if len(resp.Logins) < 1 { |
| paddy@172 | 13 return auth.Login{}, auth.ErrLoginNotFound |
| paddy@172 | 14 } |
| paddy@172 | 15 return resp.Logins[0], nil |
| paddy@172 | 16 } |