Skip to content

Commit

Permalink
examplebroker: Use auth.Mode utility functions to generate the maps o…
Browse files Browse the repository at this point in the history
…f modes
  • Loading branch information
3v1n0 committed Nov 20, 2024
1 parent 36c7a93 commit 6f91837
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions examplebroker/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,10 @@ func (b *Broker) GetAuthenticationModes(ctx context.Context, sessionID string, s
allModeIDs = append([]string{lastSelection}, allModeIDs...)
}

var authModes []*auth.Mode
for _, id := range allModeIDs {
authMode := allModes[id]
authenticationModes = append(authenticationModes, map[string]string{
layouts.ID: id,
layouts.Label: authMode.selectionLabel,
})
authModes = append(authModes, auth.NewMode(id, authMode.selectionLabel))
}
log.Debugf(ctx, "Supported authentication modes for %s: %#v", sessionID, allModes)
sessionInfo.allModes = allModes
Expand All @@ -426,7 +424,7 @@ func (b *Broker) GetAuthenticationModes(ctx context.Context, sessionID string, s
return nil, err
}

return authenticationModes, nil
return auth.NewModeMaps(authModes)
}

func getSupportedModes(sessionInfo sessionInfo, supportedUILayouts []*layouts.UILayout) map[string]authMode {
Expand Down

0 comments on commit 6f91837

Please sign in to comment.