auth

Paddy 2015-01-10 Parent:2e4b5722eed0 Child:8267e1c8bcd1

112:da2a0954e8d3 Go to Latest

auth/authd/server.go

Flesh out auth code grant (in)validation. Flesh out our tests for functions that do the validation and invalidation of the authorization code grant type's authorization codes. Basically, make sure that the auth code's are being checked right and that marking them as used after they're used works.

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 auth.RegisterClientHandlers(router, context)
37 http.Handle("/", router)
38 log.Fatal(http.ListenAndServe(":8080", nil))
39 }