Connecting the auth method service to the api handler. (#241)

pull/242/head
Todd Knight 6 years ago committed by GitHub
parent b7bf76a9ba
commit b5acf6afdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,6 +17,7 @@ import (
"github.com/hashicorp/watchtower/internal/auth"
"github.com/hashicorp/watchtower/internal/gen/controller/api/services"
"github.com/hashicorp/watchtower/internal/servers/controller/handlers/accounts"
"github.com/hashicorp/watchtower/internal/servers/controller/handlers/authmethods"
"github.com/hashicorp/watchtower/internal/servers/controller/handlers"
"github.com/hashicorp/watchtower/internal/servers/controller/handlers/authenticate"
@ -95,6 +96,13 @@ func handleGrpcGateway(c *Controller) (http.Handler, error) {
if err := services.RegisterAuthenticationServiceHandlerServer(ctx, mux, auths); err != nil {
return nil, fmt.Errorf("failed to register authenticate service handler: %w", err)
}
authMethods, err := authmethods.NewService(c.PasswordAuthRepoFn)
if err != nil {
return nil, fmt.Errorf("failed to create auth method handler service: %w", err)
}
if err := services.RegisterAuthMethodServiceHandlerServer(ctx, mux, authMethods); err != nil {
return nil, fmt.Errorf("failed to register auth method service handler: %w", err)
}
authtoks, err := authtokens.NewService(c.AuthTokenRepoFn)
if err != nil {
return nil, fmt.Errorf("failed to create auth token handler service: %w", err)

@ -46,6 +46,8 @@ func TestHandleImplementedPaths(t *testing.T) {
"v1/scopes/someid",
"v1/scopes/someid/auth-tokens",
"v1/scopes/someid/auth-tokens/someid",
"v1/scopes/someid/auth-methods",
"v1/scopes/someid/auth-methods/someid",
"v1/scopes/someid/auth-methods/someid/accounts",
"v1/scopes/someid/auth-methods/someid/accounts/someid",
"v1/scopes/someid/groups",
@ -63,6 +65,7 @@ func TestHandleImplementedPaths(t *testing.T) {
"v1/scopes/someid/groups",
"v1/scopes/someid/roles",
"v1/scopes/someid/users",
"v1/scopes/someid/auth-methods",
"v1/scopes/someid/auth-methods/someid/accounts",
// custom methods
@ -83,6 +86,7 @@ func TestHandleImplementedPaths(t *testing.T) {
"v1/scopes/someid/roles/someid",
"v1/scopes/someid/groups/someid",
"v1/scopes/someid/auth-tokens/someid",
"v1/scopes/someid/auth-methods/someid",
"v1/scopes/someid/auth-methods/someid/accounts/someid",
},
"PATCH": {
@ -90,6 +94,7 @@ func TestHandleImplementedPaths(t *testing.T) {
"v1/scopes/someid/users/someid",
"v1/scopes/someid/roles/someid",
"v1/scopes/someid/groups/someid",
"v1/scopes/someid/auth-methods/someid",
},
} {
for _, p := range paths {

Loading…
Cancel
Save