@@ -17,7 +17,6 @@ import (
17
17
18
18
"github.com/BurntSushi/toml"
19
19
"github.com/volatiletech/authboss"
20
- "github.com/volatiletech/authboss-renderer"
21
20
_ "github.com/volatiletech/authboss/auth"
22
21
"github.com/volatiletech/authboss/confirm"
23
22
"github.com/volatiletech/authboss/defaults"
@@ -28,14 +27,15 @@ import (
28
27
_ "github.com/volatiletech/authboss/register"
29
28
"github.com/volatiletech/authboss/remember"
30
29
30
+ "github.com/volatiletech/authboss-clientstate"
31
+ "github.com/volatiletech/authboss-renderer"
32
+
31
33
"golang.org/x/oauth2"
32
34
"golang.org/x/oauth2/google"
33
35
34
36
"github.com/aarondl/tpl"
35
37
"github.com/go-chi/chi"
36
38
"github.com/gorilla/schema"
37
- "github.com/gorilla/securecookie"
38
- "github.com/gorilla/sessions"
39
39
"github.com/justinas/nosurf"
40
40
)
41
41
58
58
database = NewMemStorer ()
59
59
schemaDec = schema .NewDecoder ()
60
60
61
+ sessionStore abclientstate.SessionStorer
62
+ cookieStore abclientstate.CookieStorer
63
+
61
64
templates tpl.Templates
62
65
)
63
66
67
+ const (
68
+ sessionCookieName = "ab_blog"
69
+ )
70
+
64
71
func setupAuthboss () {
65
72
ab .Config .Paths .RootURL = "http://localhost:3000"
66
73
@@ -75,8 +82,8 @@ func setupAuthboss() {
75
82
// These are all from this package since the burden is on the
76
83
// implementer for these.
77
84
ab .Config .Storage .Server = database
78
- ab .Config .Storage .SessionState = NewSessionStorer ()
79
- ab .Config .Storage .CookieState = NewCookieStorer ()
85
+ ab .Config .Storage .SessionState = sessionStore
86
+ ab .Config .Storage .CookieState = cookieStore
80
87
81
88
// Another piece that we're responsible for: Rendering views.
82
89
// Though note that we're using the authboss-renderer package
@@ -198,8 +205,8 @@ func main() {
198
205
// a configuration environment var or file.
199
206
cookieStoreKey , _ := base64 .StdEncoding .DecodeString (`NpEPi8pEjKVjLGJ6kYCS+VTCzi6BUuDzU0wrwXyf5uDPArtlofn2AG6aTMiPmN3C909rsEWMNqJqhIVPGP3Exg==` )
200
207
sessionStoreKey , _ := base64 .StdEncoding .DecodeString (`AbfYwmmt8UCwUuhd9qvfNA9UCuN1cVcKJN1ofbiky6xCyyBj20whe40rJa3Su0WOWLWcPpO1taqJdsEI/65+JA==` )
201
- cookieStore = securecookie . New (cookieStoreKey , nil )
202
- sessionStore = sessions . NewCookieStore ( sessionStoreKey )
208
+ cookieStore = abclientstate . NewCookieStorer (cookieStoreKey , nil )
209
+ sessionStore = abclientstate . NewSessionStorer ( sessionCookieName , sessionStoreKey , nil )
203
210
204
211
// Initialize authboss
205
212
setupAuthboss ()
0 commit comments