Skip to content

Commit

Permalink
Addressing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
denisonbarbosa committed Jul 28, 2023
1 parent be69dbb commit 7f3a9f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions internal/brokers/examplebroker.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,10 @@ func (b *exampleBroker) IsAuthorized(ctx context.Context, sessionID, authenticat
b.userLastSelectedMode[sessionInfo.username] = sessionInfo.selectedMode
b.userLastSelectedModeMu.Unlock()

return access, infoUser, nil
return access, infoUser, err
}

//nolint:unparam // This function needs to respect the Brokerer interface, even though it can not error out.
//nolint:unparam // This is an static example implementation, so we don't return an error other than nil.
func (b *exampleBroker) handleIsAuthorized(ctx context.Context, sessionInfo sessionInfo, authData map[string]string) (access, infoUser string, err error) {
// Note that the "wait" authentication can be cancelled and switch to another mode with a challenge.
// Take into account the cancellation.
Expand Down
12 changes: 6 additions & 6 deletions internal/brokers/localbroker.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@ import (
"errors"
)

//nolint:unused // Those should never be called
//nolint:unused // We still need localBroker to implement the brokerer interface, even though this type will not be interacted with by the daemon.
type localBroker struct {
}

//nolint:unused // Those should never be called
//nolint:unused // We still need localBroker to implement the brokerer interface, even though this method should never be called on it.
func (b localBroker) GetAuthenticationModes(ctx context.Context, username, lang string, supportedUILayouts []map[string]string) (sessionID, encryptionKey string, authenticationModes []map[string]string, err error) {
return "", "", nil, errors.New("GetAuthenticationModes should never be called on local broker")
}

//nolint:unused // Those should never be called
//nolint:unused // We still need localBroker to implement the brokerer interface, even though this method should never be called on it.
func (b localBroker) SelectAuthenticationMode(ctx context.Context, sessionID, authenticationModeName string) (uiLayoutInfo map[string]string, err error) {
return nil, errors.New("SelectAuthenticationMode should never be called on local broker")
}

//nolint:unused // Those should never be called
//nolint:unused // We still need localBroker to implement the brokerer interface, even though this method should never be called on it.
func (b localBroker) IsAuthorized(ctx context.Context, sessionID, authenticationData string) (access, infoUser string, err error) {
return "", "", errors.New("IsAuthorized should never be called on local broker")
}

//nolint:unused // Those should never be called
//nolint:unused // We still need localBroker to implement the brokerer interface, even though this method should never be called on it.
func (b localBroker) AbortSession(ctx context.Context, sessionID string) (err error) {
return errors.New("AbortSession should never be called on local broker")
}

//nolint:unused // Those should never be called
//nolint:unused // We still need localBroker to implement the brokerer interface, even though this method should never be called on it.
func (b localBroker) CancelIsAuthorized(ctx context.Context, sessionID string) {
}

0 comments on commit 7f3a9f5

Please sign in to comment.