Skip to content

Commit

Permalink
refactor: we need the context in the SetupOauth2 func
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Huck committed Dec 12, 2023
1 parent 3f46513 commit b4c9b72
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/adapter/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Configurable interface {
}

type OAuth2Adapter interface {
SetupOauth2(credentials auth.Credentials, storage auth.Storage, bindPort uint) error
SetupOauth2(ctx context.Context, credentials auth.Credentials, storage auth.Storage, bindPort uint) error
}

// ConfigReader provides an interface for adapters to load their own configuration map.
Expand Down
2 changes: 1 addition & 1 deletion internal/adapter/google/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type CalendarAPI struct {
storage auth.Storage
}

func (c *CalendarAPI) SetupOauth2(credentials auth.Credentials, storage auth.Storage, bindPort uint) error {
func (c *CalendarAPI) SetupOauth2(ctx context.Context, credentials auth.Credentials, storage auth.Storage, bindPort uint) error {
// Google Adapter does not need the tenantId
switch {
case credentials.Client.Id == "":
Expand Down
2 changes: 1 addition & 1 deletion internal/adapter/outlook_http/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type CalendarAPI struct {
storage auth.Storage
}

func (c *CalendarAPI) SetupOauth2(credentials auth.Credentials, storage auth.Storage, bindPort uint) error {
func (c *CalendarAPI) SetupOauth2(ctx context.Context, credentials auth.Credentials, storage auth.Storage, bindPort uint) error {
// Outlook Adapter does not need the clientKey
switch {
case credentials.Client.Id == "":
Expand Down
2 changes: 1 addition & 1 deletion internal/adapter/sink_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func NewSinkAdapterFromConfig(ctx context.Context, bindPort uint, config ConfigR
}

if c, ok := client.(OAuth2Adapter); ok {
if err := c.SetupOauth2(
if err := c.SetupOauth2(ctx,
auth.Credentials{
Client: auth.Client{
Id: config.Adapter().OAuth.ClientID,
Expand Down
2 changes: 1 addition & 1 deletion internal/adapter/source_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func NewSourceAdapterFromConfig(ctx context.Context, bindPort uint, config Confi
}

if c, ok := client.(OAuth2Adapter); ok {
if err := c.SetupOauth2(
if err := c.SetupOauth2(ctx,
auth.Credentials{
Client: auth.Client{
Id: config.Adapter().OAuth.ClientID,
Expand Down

0 comments on commit b4c9b72

Please sign in to comment.