Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: TeamsSsoPrompt never completes due to timeout #1744

Closed
stepro opened this issue Jun 13, 2024 · 1 comment · Fixed by #1958 or #1981
Closed

[Bug]: TeamsSsoPrompt never completes due to timeout #1744

stepro opened this issue Jun 13, 2024 · 1 comment · Fixed by #1958 or #1981
Assignees
Labels
bug Something isn't working dev support Dev support tracking

Comments

@stepro
Copy link
Member

stepro commented Jun 13, 2024

Language

C#

Version

latest

Description

Here the timeout value (default 15 minutes) is used to assign an absolute expiration time into the state. Later, it is used to determine if the prompt has timed out. Unfortunately, the initial assignment uses DateTime.Now but the check uses DateTime.UtcNow. This means that anybody who is more than 15 minutes behind UTC will observe that the dialog always times out at this stage.

Reproduction Steps

1. Try to run the 06.auth.teamsSSO.bot in the US, which is 5 or more hours behind UTC. It always silently ends the dialog before handling the token exchange invoke activity.
@stepro stepro added the bug Something isn't working label Jun 13, 2024
@corinagum corinagum assigned corinagum and singhk97 and unassigned corinagum Jun 18, 2024
@corinagum corinagum added the dev support Dev support tracking label Jun 18, 2024
@singhk97
Copy link
Collaborator

This issue does not exist in JS. new Date().getTime() is used in both setting the state.experies property and the check.

Definition:

state.expires = new Date().getTime() + timeout;

Check:
const hasTimedOut: boolean = isTimeoutActivityType && new Date().getTime() > state.expires;

singhk97 added a commit that referenced this issue Sep 4, 2024
## Linked issues

closes: #1744 #1933

## Details

Fixed bug in both #1744 and #1933. 

The issue does not persist in either JS, or PY so the fix is only for
C#.

#### Change details
* Refactored `FilteredTeamsSSOTokenExchangeMiddleware` as the underlying
middleware was not being invoked correctly.
* The `app.adapter.Use` method was being called for every incomming
request (since the `Application` object is a transient in the Asp.NET
service collection).
* As for the issue in #1744 - The code is updated to use
`DateTime.UtcNow` by default.

## Attestation Checklist

- [x] My code follows the style guidelines of this project

- I have checked for/fixed spelling, linting, and other errors
- I have commented my code for clarity
- I have made corresponding changes to the documentation (updating the
doc strings in the code is sufficient)
- My changes generate no new warnings
- I have added tests that validates my changes, and provides sufficient
test coverage. I have tested with:
  - Local testing
  - E2E testing in Teams
- New and existing unit tests pass locally with my changes

### Additional information

> Feel free to add other relevant information below
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dev support Dev support tracking
Projects
None yet
3 participants