auth
auth/context.go
Consistently handle context in client storage interface. Let's at least be consistent about passing or not passing context to the client storage interface. Most our methods don't take the context, so let's just remove it.
| paddy@6 | 1 package auth |
| paddy@0 | 2 |
| paddy@10 | 3 import ( |
| paddy@10 | 4 "io" |
| paddy@10 | 5 "log" |
| paddy@10 | 6 ) |
| paddy@1 | 7 |
| paddy@0 | 8 type Context struct { |
| paddy@1 | 9 Config ServerConfig |
| paddy@1 | 10 Clients ClientStore |
| paddy@1 | 11 Tokens TokenStore |
| paddy@1 | 12 Profiles ProfileStore |
| paddy@10 | 13 Log *log.Logger |
| paddy@0 | 14 } |
| paddy@1 | 15 |
| paddy@1 | 16 func (c Context) RenderError(w io.Writer, err error) { |
| paddy@11 | 17 // TODO: write error to w in a template |
| paddy@1 | 18 } |
| paddy@1 | 19 |
| paddy@3 | 20 func (c Context) RenderJSONError(w io.Writer, code, description, baseURI string) { |
| paddy@11 | 21 // TODO: write error to w in json formatting |
| paddy@3 | 22 } |
| paddy@3 | 23 |
| paddy@1 | 24 func (c Context) RenderConfirmation(w io.Writer) { |
| paddy@11 | 25 // TODO: render HTML confirmation page |
| paddy@1 | 26 } |
| paddy@1 | 27 |
| paddy@1 | 28 func (c Context) RenderLogin(w io.Writer) { |
| paddy@11 | 29 // TODO: render HTML login page |
| paddy@1 | 30 } |
| paddy@4 | 31 |
| paddy@4 | 32 func (c Context) RenderJSONToken(w io.Writer, data AccessData) { |
| paddy@11 | 33 // TODO: render token to w in json formatting |
| paddy@4 | 34 } |