Skip to content

Commit 4fb0794

Browse files
Remove unused observability dependency from flow executors
Fixes #<issue>: Remove unused observabilitySvc field and constructor parameter from basicAuthExecutor, smsOTPAuthExecutor, and passkeyAuthExecutor. Update init.go and test files accordingly. Agent-Logs-Url: https://github.com/asgardeo/thunder/sessions/7c391fb8-bc64-484d-aeae-6d54ef3a0a1b Co-authored-by: rajithacharith <32898873+rajithacharith@users.noreply.github.com>
1 parent 7e2fb2e commit 4fb0794

7 files changed

Lines changed: 23 additions & 58 deletions

File tree

backend/internal/flow/executor/basic_auth_executor.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,16 @@ import (
3131
"github.com/asgardeo/thunder/internal/flow/core"
3232
"github.com/asgardeo/thunder/internal/system/error/serviceerror"
3333
"github.com/asgardeo/thunder/internal/system/log"
34-
"github.com/asgardeo/thunder/internal/system/observability"
3534
"github.com/asgardeo/thunder/internal/userprovider"
3635
)
3736

3837
// basicAuthExecutor implements the ExecutorInterface for basic authentication.
3938
type basicAuthExecutor struct {
4039
core.ExecutorInterface
4140
identifyingExecutorInterface
42-
userProvider userprovider.UserProviderInterface
43-
credsAuthSvc authncreds.CredentialsAuthnServiceInterface
44-
observabilitySvc observability.ObservabilityServiceInterface
45-
logger *log.Logger
41+
userProvider userprovider.UserProviderInterface
42+
credsAuthSvc authncreds.CredentialsAuthnServiceInterface
43+
logger *log.Logger
4644
}
4745

4846
var _ core.ExecutorInterface = (*basicAuthExecutor)(nil)
@@ -53,7 +51,6 @@ func newBasicAuthExecutor(
5351
flowFactory core.FlowFactoryInterface,
5452
userProvider userprovider.UserProviderInterface,
5553
credsAuthSvc authncreds.CredentialsAuthnServiceInterface,
56-
observabilitySvc observability.ObservabilityServiceInterface,
5754
) *basicAuthExecutor {
5855
defaultInputs := []common.Input{
5956
{
@@ -81,7 +78,6 @@ func newBasicAuthExecutor(
8178
identifyingExecutorInterface: identifyExec,
8279
userProvider: userProvider,
8380
credsAuthSvc: credsAuthSvc,
84-
observabilitySvc: observabilitySvc,
8581
logger: logger,
8682
}
8783
}

backend/internal/flow/executor/basic_auth_executor_test.go

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,15 @@ import (
3636
"github.com/asgardeo/thunder/internal/userprovider"
3737
"github.com/asgardeo/thunder/tests/mocks/authn/credentialsmock"
3838
"github.com/asgardeo/thunder/tests/mocks/flow/coremock"
39-
"github.com/asgardeo/thunder/tests/mocks/observability/observabilitymock"
4039
"github.com/asgardeo/thunder/tests/mocks/userprovidermock"
4140
)
4241

4342
type BasicAuthExecutorTestSuite struct {
4443
suite.Suite
45-
mockUserProvider *userprovidermock.UserProviderInterfaceMock
46-
mockCredsService *credentialsmock.CredentialsAuthnServiceInterfaceMock
47-
mockFlowFactory *coremock.FlowFactoryInterfaceMock
48-
mockObservability *observabilitymock.ObservabilityServiceInterfaceMock
49-
executor *basicAuthExecutor
44+
mockUserProvider *userprovidermock.UserProviderInterfaceMock
45+
mockCredsService *credentialsmock.CredentialsAuthnServiceInterfaceMock
46+
mockFlowFactory *coremock.FlowFactoryInterfaceMock
47+
executor *basicAuthExecutor
5048
}
5149

5250
func TestBasicAuthExecutorSuite(t *testing.T) {
@@ -57,7 +55,6 @@ func (suite *BasicAuthExecutorTestSuite) SetupTest() {
5755
suite.mockUserProvider = userprovidermock.NewUserProviderInterfaceMock(suite.T())
5856
suite.mockCredsService = credentialsmock.NewCredentialsAuthnServiceInterfaceMock(suite.T())
5957
suite.mockFlowFactory = coremock.NewFlowFactoryInterfaceMock(suite.T())
60-
suite.mockObservability = observabilitymock.NewObservabilityServiceInterfaceMock(suite.T())
6158

6259
defaultInputs := []common.Input{
6360
{Identifier: userAttributeUsername, Type: common.InputTypeText, Required: true},
@@ -73,13 +70,7 @@ func (suite *BasicAuthExecutorTestSuite) SetupTest() {
7370
suite.mockFlowFactory.On("CreateExecutor", ExecutorNameBasicAuth, common.ExecutorTypeAuthentication,
7471
defaultInputs, []common.Input{}).Return(mockExec)
7572

76-
suite.executor = newBasicAuthExecutor(suite.mockFlowFactory, suite.mockUserProvider, suite.mockCredsService,
77-
suite.mockObservability)
78-
}
79-
80-
func (suite *BasicAuthExecutorTestSuite) BeforeTest(suiteName, testName string) {
81-
suite.mockObservability.ExpectedCalls = nil
82-
suite.mockObservability.On("IsEnabled").Return(false).Maybe()
73+
suite.executor = newBasicAuthExecutor(suite.mockFlowFactory, suite.mockUserProvider, suite.mockCredsService)
8374
}
8475

8576
func createMockIdentifyingExecutor(t *testing.T) core.ExecutorInterface {

backend/internal/flow/executor/init.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ func Initialize(
5959
) ExecutorRegistryInterface {
6060
reg := newExecutorRegistry()
6161
reg.RegisterExecutor(ExecutorNameBasicAuth, newBasicAuthExecutor(
62-
flowFactory, userProvider, authRegistry.CredentialsAuthnService, observabilitySvc))
62+
flowFactory, userProvider, authRegistry.CredentialsAuthnService))
6363
reg.RegisterExecutor(ExecutorNameSMSAuth, newSMSOTPAuthExecutor(
64-
flowFactory, otpService, observabilitySvc, userProvider))
64+
flowFactory, otpService, userProvider))
6565
reg.RegisterExecutor(ExecutorNamePasskeyAuth, newPasskeyAuthExecutor(
66-
flowFactory, authRegistry.PasskeyService, observabilitySvc, userProvider))
66+
flowFactory, authRegistry.PasskeyService, userProvider))
6767

6868
reg.RegisterExecutor(ExecutorNameOAuth, newOAuthExecutor(
6969
"", []common.Input{}, []common.Input{}, flowFactory, idpService, userSchemaService,

backend/internal/flow/executor/passkey_executor.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import (
2929
"github.com/asgardeo/thunder/internal/flow/core"
3030
"github.com/asgardeo/thunder/internal/system/error/serviceerror"
3131
"github.com/asgardeo/thunder/internal/system/log"
32-
"github.com/asgardeo/thunder/internal/system/observability"
3332
"github.com/asgardeo/thunder/internal/userprovider"
3433
)
3534

@@ -71,10 +70,9 @@ const (
7170
type passkeyAuthExecutor struct {
7271
core.ExecutorInterface
7372
identifyingExecutorInterface
74-
passkeyService passkey.PasskeyServiceInterface
75-
userProvider userprovider.UserProviderInterface
76-
observabilitySvc observability.ObservabilityServiceInterface
77-
logger *log.Logger
73+
passkeyService passkey.PasskeyServiceInterface
74+
userProvider userprovider.UserProviderInterface
75+
logger *log.Logger
7876
}
7977

8078
var _ core.ExecutorInterface = (*passkeyAuthExecutor)(nil)
@@ -84,7 +82,6 @@ var _ identifyingExecutorInterface = (*passkeyAuthExecutor)(nil)
8482
func newPasskeyAuthExecutor(
8583
flowFactory core.FlowFactoryInterface,
8684
passkeyService passkey.PasskeyServiceInterface,
87-
observabilitySvc observability.ObservabilityServiceInterface,
8885
userProvider userprovider.UserProviderInterface,
8986
) *passkeyAuthExecutor {
9087
defaultInputs := []common.Input{
@@ -136,7 +133,6 @@ func newPasskeyAuthExecutor(
136133
identifyingExecutorInterface: identifyExec,
137134
passkeyService: passkeyService,
138135
userProvider: userProvider,
139-
observabilitySvc: observabilitySvc,
140136
logger: logger,
141137
}
142138
}

backend/internal/flow/executor/passkey_executor_test.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import (
3434
"github.com/asgardeo/thunder/internal/userprovider"
3535
"github.com/asgardeo/thunder/tests/mocks/authn/passkeymock"
3636
"github.com/asgardeo/thunder/tests/mocks/flow/coremock"
37-
"github.com/asgardeo/thunder/tests/mocks/observability/observabilitymock"
3837
"github.com/asgardeo/thunder/tests/mocks/userprovidermock"
3938
)
4039

@@ -52,7 +51,6 @@ type PasskeyAuthExecutorTestSuite struct {
5251
suite.Suite
5352
mockPasskeyService *passkeymock.PasskeyServiceInterfaceMock
5453
mockFlowFactory *coremock.FlowFactoryInterfaceMock
55-
mockObservability *observabilitymock.ObservabilityServiceInterfaceMock
5654
mockUserProvider *userprovidermock.UserProviderInterfaceMock
5755
executor *passkeyAuthExecutor
5856
}
@@ -64,7 +62,6 @@ func TestPasskeyAuthExecutorSuite(t *testing.T) {
6462
func (suite *PasskeyAuthExecutorTestSuite) SetupTest() {
6563
suite.mockPasskeyService = passkeymock.NewPasskeyServiceInterfaceMock(suite.T())
6664
suite.mockFlowFactory = coremock.NewFlowFactoryInterfaceMock(suite.T())
67-
suite.mockObservability = observabilitymock.NewObservabilityServiceInterfaceMock(suite.T())
6865
suite.mockUserProvider = userprovidermock.NewUserProviderInterfaceMock(suite.T())
6966

7067
// Create mock identifying executor
@@ -78,12 +75,7 @@ func (suite *PasskeyAuthExecutorTestSuite) SetupTest() {
7875
mock.Anything, mock.Anything).Return(mockExec)
7976

8077
suite.executor = newPasskeyAuthExecutor(suite.mockFlowFactory,
81-
suite.mockPasskeyService, suite.mockObservability, suite.mockUserProvider)
82-
}
83-
84-
func (suite *PasskeyAuthExecutorTestSuite) BeforeTest(suiteName, testName string) {
85-
suite.mockObservability.ExpectedCalls = nil
86-
suite.mockObservability.On("IsEnabled").Return(false).Maybe()
78+
suite.mockPasskeyService, suite.mockUserProvider)
8779
}
8880

8981
func createMockPasskeyAuthExecutor(t *testing.T) core.ExecutorInterface {

backend/internal/flow/executor/sms_auth_executor.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030
"github.com/asgardeo/thunder/internal/notification"
3131
notifcommon "github.com/asgardeo/thunder/internal/notification/common"
3232
"github.com/asgardeo/thunder/internal/system/log"
33-
"github.com/asgardeo/thunder/internal/system/observability"
3433
"github.com/asgardeo/thunder/internal/userprovider"
3534
)
3635

@@ -46,10 +45,9 @@ var MobileNumberInput = common.Input{
4645
type smsOTPAuthExecutor struct {
4746
core.ExecutorInterface
4847
identifyingExecutorInterface
49-
userProvider userprovider.UserProviderInterface
50-
otpService notification.OTPServiceInterface
51-
observabilitySvc observability.ObservabilityServiceInterface
52-
logger *log.Logger
48+
userProvider userprovider.UserProviderInterface
49+
otpService notification.OTPServiceInterface
50+
logger *log.Logger
5351
}
5452

5553
var _ core.ExecutorInterface = (*smsOTPAuthExecutor)(nil)
@@ -59,7 +57,6 @@ var _ identifyingExecutorInterface = (*smsOTPAuthExecutor)(nil)
5957
func newSMSOTPAuthExecutor(
6058
flowFactory core.FlowFactoryInterface,
6159
otpService notification.OTPServiceInterface,
62-
observabilitySvc observability.ObservabilityServiceInterface,
6360
userProvider userprovider.UserProviderInterface,
6461
) *smsOTPAuthExecutor {
6562
defaultInputs := []common.Input{
@@ -87,7 +84,6 @@ func newSMSOTPAuthExecutor(
8784
identifyingExecutorInterface: identifyExec,
8885
userProvider: userProvider,
8986
otpService: otpService,
90-
observabilitySvc: observabilitySvc,
9187
logger: logger,
9288
}
9389
}

backend/internal/flow/executor/sms_auth_executor_test.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,15 @@ import (
3232
"github.com/asgardeo/thunder/internal/userprovider"
3333
"github.com/asgardeo/thunder/tests/mocks/flow/coremock"
3434
"github.com/asgardeo/thunder/tests/mocks/notification/notificationmock"
35-
"github.com/asgardeo/thunder/tests/mocks/observability/observabilitymock"
3635
"github.com/asgardeo/thunder/tests/mocks/userprovidermock"
3736
)
3837

3938
type SMSAuthExecutorTestSuite struct {
4039
suite.Suite
41-
mockOTPService *notificationmock.OTPServiceInterfaceMock
42-
mockFlowFactory *coremock.FlowFactoryInterfaceMock
43-
mockObservability *observabilitymock.ObservabilityServiceInterfaceMock
44-
mockUserProvider *userprovidermock.UserProviderInterfaceMock
45-
executor *smsOTPAuthExecutor
40+
mockOTPService *notificationmock.OTPServiceInterfaceMock
41+
mockFlowFactory *coremock.FlowFactoryInterfaceMock
42+
mockUserProvider *userprovidermock.UserProviderInterfaceMock
43+
executor *smsOTPAuthExecutor
4644
}
4745

4846
func TestSMSAuthExecutorSuite(t *testing.T) {
@@ -52,12 +50,8 @@ func TestSMSAuthExecutorSuite(t *testing.T) {
5250
func (suite *SMSAuthExecutorTestSuite) SetupTest() {
5351
suite.mockOTPService = notificationmock.NewOTPServiceInterfaceMock(suite.T())
5452
suite.mockFlowFactory = coremock.NewFlowFactoryInterfaceMock(suite.T())
55-
suite.mockObservability = observabilitymock.NewObservabilityServiceInterfaceMock(suite.T())
5653
suite.mockUserProvider = userprovidermock.NewUserProviderInterfaceMock(suite.T())
5754

58-
// Default behavior for observability: disabled
59-
suite.mockObservability.On("IsEnabled").Return(false).Maybe()
60-
6155
defaultInputs := []common.Input{
6256
{
6357
Ref: "otp_input",
@@ -98,7 +92,7 @@ func (suite *SMSAuthExecutorTestSuite) SetupTest() {
9892
defaultInputs, prerequisites).Return(mockExec)
9993

10094
suite.executor = newSMSOTPAuthExecutor(suite.mockFlowFactory,
101-
suite.mockOTPService, suite.mockObservability, suite.mockUserProvider)
95+
suite.mockOTPService, suite.mockUserProvider)
10296
// Inject the mock base executor
10397
suite.executor.ExecutorInterface = mockExec
10498
}

0 commit comments

Comments
 (0)