From 24ae66feb5605d105cb2901fae14906499da2d05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 20 Nov 2024 19:13:37 +0100 Subject: [PATCH] examplebroker: Use auth.Mode utility functions to generate the maps of modes --- examplebroker/broker.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/examplebroker/broker.go b/examplebroker/broker.go index 44cee5b0f..1c965053b 100644 --- a/examplebroker/broker.go +++ b/examplebroker/broker.go @@ -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 @@ -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 {