-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c9ed50a
commit 7d462a4
Showing
17 changed files
with
428 additions
and
428 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,17 +79,17 @@ type AuthProvider interface { | |
|
||
// HandleAuthLogin godoc | ||
// | ||
// @Summary User Login | ||
// @Tags Authentication | ||
// @Accept x-www-form-urlencoded | ||
// @Accept application/json | ||
// @Param username formData string false "string" example([email protected]) | ||
// @Param password formData string false "string" example(admin) | ||
// @Param payload body LoginForm true "Login Data" | ||
// @Param provider query string false "auth provider" | ||
// @Produce json | ||
// @Success 200 {object} TokenResponse | ||
// @Router /v1/users/login [POST] | ||
// @Summary User Login | ||
// @Tags Authentication | ||
// @Accept x-www-form-urlencoded | ||
// @Accept application/json | ||
// @Param username formData string false "string" example([email protected]) | ||
// @Param password formData string false "string" example(admin) | ||
// @Param payload body LoginForm true "Login Data" | ||
// @Param provider query string false "auth provider" | ||
// @Produce json | ||
// @Success 200 {object} TokenResponse | ||
// @Router /v1/users/login [POST] | ||
func (ctrl *V1Controller) HandleAuthLogin(ps ...AuthProvider) errchain.HandlerFunc { | ||
if len(ps) == 0 { | ||
panic("no auth providers provided") | ||
|
@@ -131,11 +131,11 @@ func (ctrl *V1Controller) HandleAuthLogin(ps ...AuthProvider) errchain.HandlerFu | |
|
||
// HandleAuthLogout godoc | ||
// | ||
// @Summary User Logout | ||
// @Tags Authentication | ||
// @Success 204 | ||
// @Router /v1/users/logout [POST] | ||
// @Security Bearer | ||
// @Summary User Logout | ||
// @Tags Authentication | ||
// @Success 204 | ||
// @Router /v1/users/logout [POST] | ||
// @Security Bearer | ||
func (ctrl *V1Controller) HandleAuthLogout() errchain.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) error { | ||
token := services.UseTokenCtx(r.Context()) | ||
|
@@ -155,13 +155,13 @@ func (ctrl *V1Controller) HandleAuthLogout() errchain.HandlerFunc { | |
|
||
// HandleAuthRefresh godoc | ||
// | ||
// @Summary User Token Refresh | ||
// @Description handleAuthRefresh returns a handler that will issue a new token from an existing token. | ||
// @Description This does not validate that the user still exists within the database. | ||
// @Tags Authentication | ||
// @Success 200 | ||
// @Router /v1/users/refresh [GET] | ||
// @Security Bearer | ||
// @Summary User Token Refresh | ||
// @Description handleAuthRefresh returns a handler that will issue a new token from an existing token. | ||
// @Description This does not validate that the user still exists within the database. | ||
// @Tags Authentication | ||
// @Success 200 | ||
// @Router /v1/users/refresh [GET] | ||
// @Security Bearer | ||
func (ctrl *V1Controller) HandleAuthRefresh() errchain.HandlerFunc { | ||
return func(w http.ResponseWriter, r *http.Request) error { | ||
requestToken := services.UseTokenCtx(r.Context()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.