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()
params := httprouter.Params{}
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)

View File

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

View File

@ -202,7 +202,7 @@ func NewMux(opts MuxOpts, service Service) http.Handler {
// Encapsulate the router with OAuth2
var auth http.Handler
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
router.GET(allRoutes.LogoutLink, Logout("/", basepath, allRoutes.AuthRoutes))