Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Use Proxy from common #2377

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ ignored = [

[[constraint]]
name = "github.com/fabric8-services/fabric8-common"
revision = "51e44b47e514721ddaa3fca99e5fb5bc1a6e7eb2"
revision = "a85e65e22cfc18d7c2004317d340ad328ca8dcd1"

[[constraint]]
name = "github.com/jstemmer/go-junit-report"
Expand Down
13 changes: 7 additions & 6 deletions controller/collaborators.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package controller
import (
"net/http"

"github.com/fabric8-services/fabric8-common/httpsupport"
"github.com/fabric8-services/fabric8-wit/app"
"github.com/fabric8-services/fabric8-wit/auth"
"github.com/fabric8-services/fabric8-wit/rest/proxy"

"github.com/goadesign/goa"
)

Expand All @@ -28,25 +29,25 @@ func NewCollaboratorsController(service *goa.Service, config CollaboratorsConfig

// List collaborators for the given space ID.
func (c *CollaboratorsController) List(ctx *app.ListCollaboratorsContext) error {
return proxy.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())
return httpsupport.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())
}

// Add user's identity to the list of space collaborators.
func (c *CollaboratorsController) Add(ctx *app.AddCollaboratorsContext) error {
return proxy.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())
return httpsupport.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())
}

// AddMany adds user's identities to the list of space collaborators.
func (c *CollaboratorsController) AddMany(ctx *app.AddManyCollaboratorsContext) error {
return proxy.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())
return httpsupport.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())
}

// Remove user from the list of space collaborators.
func (c *CollaboratorsController) Remove(ctx *app.RemoveCollaboratorsContext) error {
return proxy.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())
return httpsupport.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())
}

// RemoveMany removes users from the list of space collaborators.
func (c *CollaboratorsController) RemoveMany(ctx *app.RemoveManyCollaboratorsContext) error {
return proxy.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())
return httpsupport.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())
}
7 changes: 4 additions & 3 deletions controller/features.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package controller

import (
"github.com/fabric8-services/fabric8-common/httpsupport"
"github.com/fabric8-services/fabric8-wit/app"
"github.com/fabric8-services/fabric8-wit/rest/proxy"

"github.com/goadesign/goa"
)

Expand All @@ -27,10 +28,10 @@ func NewFeaturesController(service *goa.Service, config FeaturesControllerConfig

// List runs the list action.
func (c *FeaturesController) List(ctx *app.ListFeaturesContext) error {
return proxy.RouteHTTP(ctx, c.config.GetTogglesServiceURL())
return httpsupport.RouteHTTP(ctx, c.config.GetTogglesServiceURL())
}

// Show runs the show action.
func (c *FeaturesController) Show(ctx *app.ShowFeaturesContext) error {
return proxy.RouteHTTP(ctx, c.config.GetTogglesServiceURL())
return httpsupport.RouteHTTP(ctx, c.config.GetTogglesServiceURL())
}
6 changes: 3 additions & 3 deletions controller/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"net/http"
"net/url"

"github.com/fabric8-services/fabric8-common/httpsupport"
"github.com/fabric8-services/fabric8-wit/account"
"github.com/fabric8-services/fabric8-wit/app"
"github.com/fabric8-services/fabric8-wit/auth"
Expand All @@ -13,7 +14,6 @@ import (
"github.com/fabric8-services/fabric8-wit/jsonapi"
"github.com/fabric8-services/fabric8-wit/login"

"github.com/fabric8-services/fabric8-wit/rest/proxy"
"github.com/goadesign/goa"
)

Expand Down Expand Up @@ -49,7 +49,7 @@ func (c *LoginController) Authorize(ctx *app.AuthorizeLoginContext) error {

// Refresh obtain a new access token using the refresh token.
func (c *LoginController) Refresh(ctx *app.RefreshLoginContext) error {
return proxy.RouteHTTPToPath(ctx, c.configuration.GetAuthShortServiceHostName(), authservice.RefreshTokenPath())
return httpsupport.RouteHTTPToPath(ctx, c.configuration.GetAuthShortServiceHostName(), authservice.RefreshTokenPath())
}

func redirectLocation(params url.Values, location string) (string, error) {
Expand Down Expand Up @@ -77,5 +77,5 @@ func redirectWithParams(ctx redirectContext, config auth.ServiceConfiguration, h

// Generate generates access tokens in Dev Mode
func (c *LoginController) Generate(ctx *app.GenerateLoginContext) error {
return proxy.RouteHTTPToPath(ctx, c.configuration.GetAuthServiceURL(), authservice.GenerateTokenPath())
return httpsupport.RouteHTTPToPath(ctx, c.configuration.GetAuthServiceURL(), authservice.GenerateTokenPath())
}
5 changes: 2 additions & 3 deletions controller/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"strings"
"time"

"github.com/fabric8-services/fabric8-common/httpsupport"
"github.com/fabric8-services/fabric8-common/id"

"github.com/fabric8-services/fabric8-wit/app"
"github.com/fabric8-services/fabric8-wit/application"
"github.com/fabric8-services/fabric8-wit/auth"
Expand All @@ -20,7 +20,6 @@ import (
"github.com/fabric8-services/fabric8-wit/jsonapi"
"github.com/fabric8-services/fabric8-wit/log"
"github.com/fabric8-services/fabric8-wit/ptr"
"github.com/fabric8-services/fabric8-wit/rest/proxy"
"github.com/fabric8-services/fabric8-wit/search"
"github.com/fabric8-services/fabric8-wit/space"
"github.com/fabric8-services/fabric8-wit/workitem"
Expand Down Expand Up @@ -463,7 +462,7 @@ func (c *SearchController) Spaces(ctx *app.SpacesSearchContext) error {

// Users runs the user search action.
func (c *SearchController) Users(ctx *app.UsersSearchContext) error {
return proxy.RouteHTTP(ctx, c.configuration.GetAuthShortServiceHostName())
return httpsupport.RouteHTTP(ctx, c.configuration.GetAuthShortServiceHostName())
}

// Iterate over the WI list and read parent IDs
Expand Down
11 changes: 5 additions & 6 deletions controller/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@ package controller
import (
"context"
"fmt"
"github.com/fabric8-services/fabric8-wit/errors"
"math/rand"
"net/http"

"github.com/fabric8-services/fabric8-common/httpsupport"
idpackage "github.com/fabric8-services/fabric8-common/id"
"github.com/fabric8-services/fabric8-wit/account"
"github.com/fabric8-services/fabric8-wit/app"
"github.com/fabric8-services/fabric8-wit/application"
"github.com/fabric8-services/fabric8-wit/auth"
"github.com/fabric8-services/fabric8-wit/errors"
"github.com/fabric8-services/fabric8-wit/jsonapi"
"github.com/fabric8-services/fabric8-wit/log"
"github.com/fabric8-services/fabric8-wit/rest"
"github.com/fabric8-services/fabric8-wit/token"

"github.com/fabric8-services/fabric8-wit/rest/proxy"
"github.com/goadesign/goa"
errs "github.com/pkg/errors"
"github.com/satori/go.uuid"
Expand Down Expand Up @@ -158,7 +157,7 @@ func (c *UsersController) Obfuscate(ctx *app.ObfuscateUsersContext) error {

// Show runs the show action.
func (c *UsersController) Show(ctx *app.ShowUsersContext) error {
return proxy.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())
return httpsupport.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())
}

// CreateUserAsServiceAccount updates a user when requested using a service account token
Expand Down Expand Up @@ -398,12 +397,12 @@ func (c *UsersController) updateUserInDB(id *uuid.UUID, ctx *app.UpdateUserAsSer

// Update updates the authorized user based on the provided Token
func (c *UsersController) Update(ctx *app.UpdateUsersContext) error {
return proxy.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())
return httpsupport.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())
}

// List runs the list action.
func (c *UsersController) List(ctx *app.ListUsersContext) error {
return proxy.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())
return httpsupport.RouteHTTP(ctx, c.config.GetAuthShortServiceHostName())
}

// ConvertUsersSimple converts a array of simple Identity IDs into a Generic Reletionship List
Expand Down
167 changes: 0 additions & 167 deletions rest/proxy/proxy.go

This file was deleted.

Loading