auth

Paddy 2014-12-17 Parent:d442523df640 Child:2e4b5722eed0

107:c03b5eb3179e Go to Latest

auth/authd/server.go

Update import paths. Let's just use import paths that don't need aliasing, by specifying that they're mercurial repos.

History
1 package main
3 import (
4 "html/template"
5 "log"
6 "net/http"
8 "code.secondbit.org/auth.hg"
9 "github.com/gorilla/mux"
10 )
12 func main() {
13 store := auth.NewMemstore()
14 config := auth.Config{
15 ClientStore: store,
16 AuthCodeStore: store,
17 ProfileStore: store,
18 TokenStore: store,
19 SessionStore: store,
20 Template: template.Must(template.New("base").ParseGlob("./templates/*.gotmpl")),
21 LoginURI: "/login",
22 }
23 err := config.Init()
24 if err != nil {
25 log.Fatal(err)
26 }
27 context, err := auth.NewContext(config)
28 if err != nil {
29 panic(err)
30 }
32 router := mux.NewRouter()
33 auth.RegisterOAuth2(router, context)
34 auth.RegisterSessionHandlers(router, context)
35 auth.RegisterProfileHandlers(router, context)
36 http.Handle("/", router)
37 log.Fatal(http.ListenAndServe(":8080", nil))
38 }