Skip to content

Commit

Permalink
Update lib/client/sso/ceremony.go
Browse files Browse the repository at this point in the history
Co-authored-by: Alan Parra <[email protected]>
  • Loading branch information
Joerger and codingllama committed Oct 29, 2024
1 parent 80edc5c commit 90fc543
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/client/sso/ceremony.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,15 @@ func (m *MFACeremony) Run(ctx context.Context, chal *proto.MFAAuthenticateChalle
}, nil
}

// Close closes resources associated with the SSO MFA ceremony.
func (m *MFACeremony) Close() {
if m.close != nil {
m.close()
}
}

// NewCLIMFACeremony creates a new CLI SSO ceremony from the given redirector.
// The returned MFACeremony takes ownership of the Redirector.
func NewCLIMFACeremony(rd *Redirector) *MFACeremony {
return &MFACeremony{
clientCallbackURL: rd.ClientCallbackURL,
Expand Down
2 changes: 1 addition & 1 deletion lib/client/sso/ceremony_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ func TestCLICeremony_MFA(t *testing.T) {
Stderr: stderr,
})
require.NoError(t, err)
t.Cleanup(rd.Close)

// Construct a fake mfa response with the redirector's client callback URL.
successResponseURL, err := web.ConstructSSHResponse(web.AuthParams{
Expand All @@ -132,6 +131,7 @@ func TestCLICeremony_MFA(t *testing.T) {
t.Cleanup(mockIdPServer.Close)

ceremony := sso.NewCLIMFACeremony(rd)
t.Cleanup(ceremony.Close)

// Modify handle redirect to also browse to the clickable URL printed to stderr.
baseHandleRedirect := ceremony.HandleRedirect
Expand Down

0 comments on commit 90fc543

Please sign in to comment.