Skip to content

Commit

Permalink
chore: purge login service implementation (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
Salaton committed Aug 26, 2021
1 parent c1c8f37 commit 57a445c
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 162 deletions.
27 changes: 0 additions & 27 deletions pkg/onboarding/application/extension/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ type BaseExtension interface {
source interface{},
status int,
)

// Login
GetLoginFunc(ctx context.Context) http.HandlerFunc
GetLogoutFunc(ctx context.Context) http.HandlerFunc
GetRefreshFunc() http.HandlerFunc
GetVerifyTokenFunc(ctx context.Context) http.HandlerFunc
}

// BaseExtensionImpl ...
Expand Down Expand Up @@ -166,27 +160,6 @@ func (b *BaseExtensionImpl) GetEnvVar(envName string) (string, error) {
return serverutils.GetEnvVar(envName)
}

// GetLoginFunc returns a function that can authenticate against both Slade 360 and Firebase
func (b *BaseExtensionImpl) GetLoginFunc(ctx context.Context) http.HandlerFunc {
return apiclient.GetLoginFunc(ctx, b.fc)
}

// GetLogoutFunc logs the user out of Firebase
func (b *BaseExtensionImpl) GetLogoutFunc(ctx context.Context) http.HandlerFunc {
return apiclient.GetLogoutFunc(ctx, b.fc)
}

// GetRefreshFunc is used to refresh OAuth tokens
func (b *BaseExtensionImpl) GetRefreshFunc() http.HandlerFunc {
return apiclient.GetRefreshFunc()
}

// GetVerifyTokenFunc confirms that an EDI access token (supplied) is valid.
// If it is valid, it exchanges it for a Firebase ID token.
func (b *BaseExtensionImpl) GetVerifyTokenFunc(ctx context.Context) http.HandlerFunc {
return apiclient.GetVerifyTokenFunc(ctx, b.fc)
}

// NewServerClient ...
func (b *BaseExtensionImpl) NewServerClient(
clientID string,
Expand Down
24 changes: 0 additions & 24 deletions pkg/onboarding/application/extension/mock/extension_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ type FakeBaseExtensionImpl struct {
source interface{},
status int,
)
GetLoginFuncFn func(ctx context.Context) http.HandlerFunc
GetLogoutFuncFn func(ctx context.Context) http.HandlerFunc
GetRefreshFuncFn func() http.HandlerFunc
GetVerifyTokenFuncFn func(ctx context.Context) http.HandlerFunc
GetUserProfileByPrimaryPhoneNumberFn func(ctx context.Context, phone string, suspended bool) (*profileutils.UserProfile, error)
}

Expand Down Expand Up @@ -130,26 +126,6 @@ func (b *FakeBaseExtensionImpl) GetEnvVar(envName string) (string, error) {
return b.GetEnvVarFn(envName)
}

// GetLoginFunc ..
func (b *FakeBaseExtensionImpl) GetLoginFunc(ctx context.Context) http.HandlerFunc {
return b.GetLoginFuncFn(ctx)
}

// GetLogoutFunc ..
func (b *FakeBaseExtensionImpl) GetLogoutFunc(ctx context.Context) http.HandlerFunc {
return b.GetLogoutFuncFn(ctx)
}

// GetRefreshFunc ..
func (b *FakeBaseExtensionImpl) GetRefreshFunc() http.HandlerFunc {
return b.GetRefreshFuncFn()
}

// GetVerifyTokenFunc ..
func (b *FakeBaseExtensionImpl) GetVerifyTokenFunc(ctx context.Context) http.HandlerFunc {
return b.GetVerifyTokenFuncFn(ctx)
}

// NewServerClient ...
func (b *FakeBaseExtensionImpl) NewServerClient(
clientID string,
Expand Down

This file was deleted.

49 changes: 0 additions & 49 deletions pkg/onboarding/infrastructure/services/login_service/service.go

This file was deleted.

28 changes: 0 additions & 28 deletions pkg/onboarding/presentation/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/database/fb"
"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/engagement"

loginservice "github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/login_service"
"github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/messaging"
pubsubmessaging "github.com/savannahghi/onboarding/pkg/onboarding/infrastructure/services/pubsub"
"github.com/savannahghi/onboarding/pkg/onboarding/repository"
Expand Down Expand Up @@ -138,7 +137,6 @@ func Router(ctx context.Context) (*mux.Router, error) {
}

h := rest.NewHandlersInterfaces(i)
loginService := loginservice.NewServiceLogin(baseExt)

r := mux.NewRouter() // gorilla mux
r.Use(otelmux.Middleware(serverutils.MetricsCollectorService("onboarding")))
Expand All @@ -161,32 +159,6 @@ func Router(ctx context.Context) (*mux.Router, error) {
h.SwitchFlaggedFeaturesHandler(),
)

// login service routes
r.Path("/login").Methods(
http.MethodPost,
http.MethodOptions,
).HandlerFunc(
loginService.GetLoginFunc(ctx),
)
r.Path("/logout").Methods(
http.MethodPost,
http.MethodOptions,
).HandlerFunc(
loginService.GetLogoutFunc(ctx),
)
r.Path("/refresh").Methods(
http.MethodPost,
http.MethodOptions,
).HandlerFunc(
loginService.GetRefreshFunc(),
)
r.Path("/verify_access_token").Methods(
http.MethodPost,
http.MethodOptions,
).HandlerFunc(
loginService.GetVerifyTokenFunc(ctx),
)

r.Path("/pubsub").Methods(
http.MethodPost).
HandlerFunc(pubSub.ReceivePubSubPushMessages)
Expand Down

0 comments on commit 57a445c

Please sign in to comment.