tsk-20: Obtain refresh token (#24)
Closes #20 Reviewed-on: phoenix/textsender-auth#24 Co-authored-by: phoenix <kundeng00@pm.me> Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
@@ -79,6 +79,7 @@ func main() {
|
||||
userHandler := handler.NewUserHandler(userStore)
|
||||
loginHandler := handler.NewLoginHandler(userStore)
|
||||
serviceHandler := handler.NewServiceHandler(serviceStore)
|
||||
refreshHandler := handler.NewRefreshHandler(userStore, serviceStore)
|
||||
|
||||
router := chi.NewRouter()
|
||||
|
||||
@@ -91,6 +92,7 @@ func main() {
|
||||
router.Method("Post", endpoint.Login, http.HandlerFunc(loginHandler.Login))
|
||||
router.Method("Post", endpoint.CreateServiceUser, http.HandlerFunc(serviceHandler.Register))
|
||||
router.Method("Post", endpoint.LoginServiceUser, http.HandlerFunc(serviceHandler.Login))
|
||||
router.Method("Post", endpoint.TokenRefresh, http.HandlerFunc(refreshHandler.Refresh))
|
||||
|
||||
router.Method("GET", "/swagger/*", httpSwagger.Handler(
|
||||
httpSwagger.URL(fmt.Sprintf("http://localhost:%s/swagger/doc.json", config.Port)),
|
||||
|
||||
@@ -43,12 +43,14 @@ func TestMain(m *testing.M) {
|
||||
userHandler := handler.NewUserHandler(userStore)
|
||||
loginHandler := handler.NewLoginHandler(userStore)
|
||||
serviceHandler := handler.NewServiceHandler(serviceStore)
|
||||
refreshHandler := handler.NewRefreshHandler(userStore, serviceStore)
|
||||
|
||||
testRouter = mux.NewRouter()
|
||||
testRouter.HandleFunc(endpoint.Register, userHandler.Register).Methods("POST")
|
||||
testRouter.HandleFunc(endpoint.Login, loginHandler.Login).Methods("POST")
|
||||
testRouter.HandleFunc(endpoint.CreateServiceUser, serviceHandler.Register).Methods("POST")
|
||||
testRouter.HandleFunc(endpoint.LoginServiceUser, serviceHandler.Login).Methods("POST")
|
||||
testRouter.HandleFunc(endpoint.TokenRefresh, refreshHandler.Refresh).Methods("POST")
|
||||
|
||||
code := m.Run()
|
||||
os.Exit(code)
|
||||
|
||||
Reference in New Issue
Block a user