Skip to content

Commit

Permalink
prepare custom session creation for SIWSSB
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptix committed Mar 19, 2021
1 parent f3be29c commit baae250
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ require (
go.cryptoscope.co/muxrpc/v2 v2.0.0-beta.1.0.20210308090127-5f1f5f9cbb59
go.cryptoscope.co/netwrap v0.1.1
go.cryptoscope.co/secretstream v1.2.2
go.mindeco.de v1.8.0
go.mindeco.de v1.9.0
go.mindeco.de/ssb-refs v0.1.1-0.20210108133850-cf1f44fea870
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,8 @@ go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
go.mindeco.de v1.8.0 h1:Vxob3XaDz85aD4wq8VbQxtradpHbmjciG2eSJLGaFV0=
go.mindeco.de v1.8.0/go.mod h1:ePOcyktbpqzhMPRBDv2gUaDd3h8QtT+DUU1DK+VbQZE=
go.mindeco.de v1.9.0 h1:/xli02DkzpIUZxp/rp1nj8z/OZ9MHvkMIr9TfDVcmBg=
go.mindeco.de v1.9.0/go.mod h1:ePOcyktbpqzhMPRBDv2gUaDd3h8QtT+DUU1DK+VbQZE=
go.mindeco.de/ssb-refs v0.1.1-0.20210108133850-cf1f44fea870 h1:TCI3AefMAaOYECvppn30+CfEB0Fn8IES1SKvvacc3/c=
go.mindeco.de/ssb-refs v0.1.1-0.20210108133850-cf1f44fea870/go.mod h1:OnBnV02ux4lLsZ39LID6yYLqSDp+dqTHb/3miYPkQFs=
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
Expand Down
1 change: 1 addition & 0 deletions web/handlers/auth/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func Handler(
ssb.aliases = aliasDB
ssb.allowList = allowListDB
ssb.endpoints = endpoints
ssb.cookieAuth = ah
m.Get(router.AuthWithSSBSignIn).HandlerFunc(r.HTML("auth/withssb_sign_in.tmpl", ssb.login))

return m
Expand Down
3 changes: 3 additions & 0 deletions web/handlers/auth/withssb.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"go.cryptoscope.co/muxrpc/v2"

"go.mindeco.de/http/auth"
refs "go.mindeco.de/ssb-refs"

"github.com/ssb-ngi-pointer/go-ssb-room/internal/network"
Expand All @@ -27,6 +28,8 @@ type withssbHandler struct {
allowList roomdb.AllowListService
aliases roomdb.AliasService

cookieAuth *auth.Handler

endpoints network.Endpoints
}

Expand Down
4 changes: 2 additions & 2 deletions web/handlers/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func New(
return nil, err
}

store := &sessions.CookieStore{
cookieStore := &sessions.CookieStore{
Codecs: cookieCodec,
Options: &sessions.Options{
Path: "/",
Expand Down Expand Up @@ -198,7 +198,7 @@ func New(
})

a, err := auth.NewHandler(dbs.AuthFallback,
auth.SetStore(store),
auth.SetStore(cookieStore),
auth.SetErrorHandler(authErrH),
auth.SetNotAuthorizedHandler(notAuthorizedH),
auth.SetLifetime(2*time.Hour), // TODO: configure
Expand Down

0 comments on commit baae250

Please sign in to comment.