From be9624e2adce7c95039e62fc4ee22538d7fa2d2f Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Thu, 20 Apr 2017 09:55:02 -0400 Subject: Implement v4 endpoints for OAuth (#6040) * Implement POST /oauth/apps endpoint for APIv4 * Implement GET /oauth/apps endpoint for APIv4 * Implement GET /oauth/apps/{app_id} and /oauth/apps/{app_id}/info endpoints for APIv4 * Refactor API version independent oauth endpoints * Implement DELETE /oauth/apps/{app_id} endpoint for APIv4 * Implement /oauth/apps/{app_id}/regen_secret endpoint for APIv4 * Implement GET /user/{user_id}/oauth/apps/authorized endpoint for APIv4 * Implement POST /oauth/deauthorize endpoint --- api4/api.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'api4/api.go') diff --git a/api4/api.go b/api4/api.go index 8d03d91d1..fd9b679d2 100644 --- a/api4/api.go +++ b/api4/api.go @@ -64,8 +64,10 @@ type Routes struct { OutgoingHooks *mux.Router // 'api/v4/hooks/outgoing' OutgoingHook *mux.Router // 'api/v4/hooks/outgoing/{hook_id:[A-Za-z0-9]+}' - Admin *mux.Router // 'api/v4/admin' - OAuth *mux.Router // 'api/v4/oauth' + OAuth *mux.Router // 'api/v4/oauth' + OAuthApps *mux.Router // 'api/v4/oauth/apps' + OAuthApp *mux.Router // 'api/v4/oauth/apps/{app_id:[A-Za-z0-9]+}' + SAML *mux.Router // 'api/v4/saml' Compliance *mux.Router // 'api/v4/compliance' Cluster *mux.Router // 'api/v4/cluster' @@ -146,8 +148,11 @@ func InitApi(full bool) { BaseRoutes.OutgoingHook = BaseRoutes.OutgoingHooks.PathPrefix("/{hook_id:[A-Za-z0-9]+}").Subrouter() BaseRoutes.SAML = BaseRoutes.ApiRoot.PathPrefix("/saml").Subrouter() + BaseRoutes.OAuth = BaseRoutes.ApiRoot.PathPrefix("/oauth").Subrouter() - BaseRoutes.Admin = BaseRoutes.ApiRoot.PathPrefix("/admin").Subrouter() + BaseRoutes.OAuthApps = BaseRoutes.OAuth.PathPrefix("/apps").Subrouter() + BaseRoutes.OAuthApp = BaseRoutes.OAuthApps.PathPrefix("/{app_id:[A-Za-z0-9]+}").Subrouter() + BaseRoutes.Compliance = BaseRoutes.ApiRoot.PathPrefix("/compliance").Subrouter() BaseRoutes.Cluster = BaseRoutes.ApiRoot.PathPrefix("/cluster").Subrouter() BaseRoutes.LDAP = BaseRoutes.ApiRoot.PathPrefix("/ldap").Subrouter() @@ -180,6 +185,7 @@ func InitApi(full bool) { InitStatus() InitWebSocket() InitEmoji() + InitOAuth() InitReaction() InitWebrtc() -- cgit v1.2.3-1-g7c22