Update oauth logout to include basepath

pull/10616/head
Chris Goller 2017-12-01 15:35:39 -06:00
parent 2355c395b4
commit d6d7081b1e
3 changed files with 11 additions and 8 deletions

View File

@ -217,7 +217,10 @@ func Test_Service_DashboardCells(t *testing.T) {
ctx := context.Background() ctx := context.Background()
params := httprouter.Params{} params := httprouter.Params{}
for k, v := range test.ctxParams { for k, v := range test.ctxParams {
params = append(params, httprouter.Param{k, v}) params = append(params, httprouter.Param{
Key: k,
Value: v,
})
} }
ctx = httprouter.WithParams(ctx, params) ctx = httprouter.WithParams(ctx, params)

View File

@ -213,12 +213,12 @@ func Test_KapacitorRulesGet(t *testing.T) {
bg := context.Background() bg := context.Background()
params := httprouter.Params{ params := httprouter.Params{
{ {
"id", Key: "id",
"1", Value: "1",
}, },
{ {
"kid", Key: "kid",
"1", Value: "1",
}, },
} }
ctx := httprouter.WithParams(bg, params) ctx := httprouter.WithParams(bg, params)
@ -244,8 +244,8 @@ func Test_KapacitorRulesGet(t *testing.T) {
actual := make([]chronograf.AlertRule, len(frame.Rules)) actual := make([]chronograf.AlertRule, len(frame.Rules))
for idx, _ := range frame.Rules { for i := range frame.Rules {
actual[idx] = frame.Rules[idx].AlertRule actual[i] = frame.Rules[i].AlertRule
} }
if resp.StatusCode != http.StatusOK { if resp.StatusCode != http.StatusOK {

View File

@ -202,7 +202,7 @@ func NewMux(opts MuxOpts, service Service) http.Handler {
// Encapsulate the router with OAuth2 // Encapsulate the router with OAuth2
var auth http.Handler var auth http.Handler
auth, allRoutes.AuthRoutes = AuthAPI(opts, router) auth, allRoutes.AuthRoutes = AuthAPI(opts, router)
allRoutes.LogoutLink = "/oauth/logout" allRoutes.LogoutLink = path.Join(opts.Basepath, "/oauth/logout")
// Create middleware that redirects to the appropriate provider logout // Create middleware that redirects to the appropriate provider logout
router.GET(allRoutes.LogoutLink, Logout("/", basepath, allRoutes.AuthRoutes)) router.GET(allRoutes.LogoutLink, Logout("/", basepath, allRoutes.AuthRoutes))