forked from makeless/makeless-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
auth.go
32 lines (25 loc) · 800 Bytes
/
auth.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
package makeless_go
import "github.com/makeless/makeless-go/http"
func (makeless *Makeless) login(http makeless_go_http.Http) error {
http.GetRouter().GetEngine().POST(
"/api/login",
http.GetAuthenticator().GetMiddleware().LoginHandler,
)
return nil
}
func (makeless *Makeless) logout(http makeless_go_http.Http) error {
http.GetRouter().GetEngine().GET(
"/api/auth/logout",
http.GetAuthenticator().GetMiddleware().MiddlewareFunc(),
http.GetAuthenticator().GetMiddleware().LogoutHandler,
)
return nil
}
func (makeless *Makeless) refreshToken(http makeless_go_http.Http) error {
http.GetRouter().GetEngine().GET(
"/api/auth/refresh-token",
http.GetAuthenticator().GetMiddleware().MiddlewareFunc(),
http.GetAuthenticator().GetMiddleware().RefreshHandler,
)
return nil
}