-
Notifications
You must be signed in to change notification settings - Fork 1
/
routes.go
48 lines (39 loc) · 1.1 KB
/
routes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Package auth contains the route handlers related to authentication and authorization.
package auth
import (
"github.com/sargassum-world/godest"
"github.com/sargassum-world/godest/actioncable"
"github.com/sargassum-world/godest/authn"
"github.com/sargassum-world/godest/session"
"github.com/sargassum-world/pslive/internal/app/pslive/auth"
"github.com/sargassum-world/pslive/internal/clients/ory"
"github.com/sargassum-world/pslive/internal/clients/presence"
)
type Handlers struct {
r godest.TemplateRenderer
ss *session.Store
ac *authn.Client
oc *ory.Client
acc *actioncable.Cancellers
ps *presence.Store
l godest.Logger
}
func New(
r godest.TemplateRenderer, ss *session.Store, ac *authn.Client, oc *ory.Client,
acc *actioncable.Cancellers, ps *presence.Store, l godest.Logger,
) *Handlers {
return &Handlers{
r: r,
ss: ss,
ac: ac,
oc: oc,
acc: acc,
ps: ps,
l: l,
}
}
func (h *Handlers) Register(er godest.EchoRouter) {
er.GET("/csrf", h.HandleCSRFGet())
er.GET("/login", auth.HandleHTTPWithSession(h.HandleLoginGet(), h.ss))
er.POST("/sessions", h.HandleSessionsPost())
}