Skip to content

Commit 0fdae78

Browse files
fix totp code submission
1 parent 0ec5705 commit 0fdae78

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

edge-apis/clients_shared.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
"github.com/go-resty/resty/v2"
3737
"github.com/golang-jwt/jwt/v5"
3838
"github.com/openziti/edge-api/rest_model"
39+
"github.com/openziti/edge-api/rest_util"
3940
"github.com/zitadel/oidc/v3/pkg/client/tokenexchange"
4041
"github.com/zitadel/oidc/v3/pkg/oidc"
4142
"golang.org/x/oauth2"
@@ -459,7 +460,7 @@ func (e *EdgeOidcAuthenticator) handlePrimaryAndSecondaryAuth(verificationParams
459460
}).Post(totpUri)
460461

461462
if err != nil {
462-
return nil, err
463+
return nil, rest_util.WrapErr(err)
463464
}
464465

465466
switch resp.StatusCode() {

ziti/contexts.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ func NewContextWithOpts(cfg *Config, options *Options) (Context, error) {
146146
newContext.Emit(EventAuthQuery, authQuery)
147147

148148
if *authQuery.Provider == rest_model.MfaProvidersZiti {
149-
newContext.Emit(EventMfaTotpCode, authQuery, MfaCodeResponse(newContext.authenticateMfa))
149+
newContext.Emit(EventMfaTotpCode, authQuery, MfaCodeResponse(func(code string) error {
150+
codeCh <- code
151+
return nil
152+
}))
150153

151154
if newContext.Events().ListenerCount(EventMfaTotpCode) == 0 {
152155
pfxlog.Logger().Debugf("no callback handler registered for provider: %v, event will still be emitted", *authQuery.Provider)

0 commit comments

Comments
 (0)