Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
59e5a6b
Added structure for new authentication content
Jan 9, 2018
73aac25
Added content to top level
Jan 9, 2018
9dea71f
added structure and content
Jan 9, 2018
3497087
Rough draft of tab authentication topic with new screenshots
Jan 10, 2018
d5e4248
Fixed format issue
Jan 10, 2018
3bc9d69
Formatting test
Jan 10, 2018
188cca4
Formatting
Jan 10, 2018
908b4a2
Added content for SSO
Jan 10, 2018
1cc9843
Structural edits
Jan 10, 2018
240a3f3
list test
Jan 11, 2018
2b56efb
test
Jan 11, 2018
928e901
test
Jan 11, 2018
617ad74
test
Jan 11, 2018
041607d
Test
Jan 11, 2018
32f5c36
test
Jan 11, 2018
5a6de6e
test
Jan 11, 2018
4c290fe
test
Jan 11, 2018
40ac059
test
Jan 11, 2018
ca0fe28
indent code
Jan 11, 2018
1e618af
test
Jan 11, 2018
28eb1c8
tst
Jan 11, 2018
5b921d1
test
Jan 11, 2018
0f2c947
Updated bot auth
Jan 11, 2018
9623d18
Added new samples for bot auth
Jan 12, 2018
8bf8bdf
Corrected code for auth
Jan 12, 2018
c562311
Expanded code for bot auth
Jan 12, 2018
eef6b1b
Minor edits
Jan 12, 2018
bded07d
Merge branch 'master' of https://github.com/MicrosoftDocs/msteams-doc…
Jan 16, 2018
1f23824
Removed work in progress
Jan 16, 2018
75834cb
More term changes and rewrite
Jan 17, 2018
e91fb11
More review comments
Jan 17, 2018
ad95f64
Merge branch 'master' into Norm-Authentication_rework
Jan 23, 2018
efb2376
Review comments
Jan 23, 2018
50b0c6c
TOC
Feb 21, 2018
698714f
Added support for other providers
Feb 21, 2018
49b2551
Removed app registration
Feb 23, 2018
e10f7aa
minor edits
Feb 23, 2018
7bf9d3a
Pre publication changes
Feb 26, 2018
cd9af69
Extensive edits, added links, native image
billbliss Feb 27, 2018
a4dbd56
Added missing space
billbliss Feb 27, 2018
7653164
Made title match metadata
billbliss Feb 27, 2018
7c1fa30
Misc changes (#97)
billbliss Feb 27, 2018
6b74cb4
Merge branch 'master' into Norm-Authentication_rework
Feb 27, 2018
89eac85
Updated flow diagram
Feb 27, 2018
5eed7b4
toc changes
Feb 27, 2018
7a1ea5d
fixed link
Feb 27, 2018
31e6cfe
Extensive edits (#99)
billbliss Feb 28, 2018
3058401
Restructured auth topics
Feb 28, 2018
7230f63
added links to auth provider
Feb 28, 2018
9e5bb9e
TOC
Feb 28, 2018
19ed1e6
Changes from readthrough
Feb 28, 2018
c4bbb9a
edits
Feb 28, 2018
948edf4
edits
Feb 28, 2018
3a831c3
edits
Feb 28, 2018
5daae4a
formatting
Feb 28, 2018
3c25982
edits
Feb 28, 2018
7d4cc6b
standardize
Mar 1, 2018
794f09e
Billbl auth final edits (#102)
billbliss Mar 2, 2018
3f58823
Merge branch 'master' into Norm-Authentication_rework
Mar 2, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
standardize
  • Loading branch information
REDMOND\v-nosohl committed Mar 1, 2018
commit 7d4cc6b6c53bb15c966ea9a8920395c2fadc0217
12 changes: 6 additions & 6 deletions msteams-platform/concepts/authentication/auth-flow-bot.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ for an example that demonstrates authentication flow for bots using Node using t
3. The bot constructs the URL to the start page of the authentication flow, and sends a card to the user with a `signin` action. ([View code](https://github.com/OfficeDev/microsoft-teams-sample-auth-node/blob/469952a26d618dbf884a3be53c7d921cc580b1e2/src/dialogs/BaseIdentityDialog.ts#L160-L190))
* Like other application auth flows in Teams, the start page must be on a domain that's in your `validDomains` list, and on the same domain as the post-login redirect page.
* **IMPORTANT**: The OAuth 2.0 authorization code grant flow calls for a `state` parameter in the authentication request which contains a unique session token to prevent a [cross-site request forgery attack](https://en.wikipedia.org/wiki/Cross-site_request_forgery). The example uses a randomly-generated GUID.
4. When the user clicks on the `signin` button, Teams opens a popup window and navigates it to the start page.
4. When the user clicks on the *signin* button, Teams opens a popup window and navigates it to the start page.
5. The start page redirects the user to the identity provider's `authorize` endpoint. ([View code](https://github.com/OfficeDev/microsoft-teams-sample-auth-node/blob/469952a26d618dbf884a3be53c7d921cc580b1e2/public/html/auth-start.html#L51-L56))
6. On the provider's site, the user signs in and grants access to the bot.
7. The provider takes the user to the bot's OAuth redirect page, with an authorization code.
8. The bot redeems the authorization code for an access token, and **provisionally** associates the token with the user that initiated the sign-in flow.
* In the example, the bot associates the value of the `state` parameter with the id of the user that *initiated* the sign-in process so it can later match it with the `state` value returned by the identity provider. ([View code](https://github.com/OfficeDev/microsoft-teams-sample-auth-node/blob/469952a26d618dbf884a3be53c7d921cc580b1e2/src/AuthBot.ts#L70-L99))
* In the example, the bot associates the value of the `state` parameter with the id of the user that initiated the sign-in process so it can later match it with the `state` value returned by the identity provider. ([View code](https://github.com/OfficeDev/microsoft-teams-sample-auth-node/blob/469952a26d618dbf884a3be53c7d921cc580b1e2/src/AuthBot.ts#L70-L99))
* **IMPORTANT**: The bot stores the token it receives from the identity provider and associates it with a specific user, but it is marked as "pending validation". The token is not used while in this state. If the `state` pamrameter is valid, Teams then uses a [two-step authentication](https://en.wikipedia.org/wiki/Man-in-the-middle_attack) process to ensure that the user who authorized the bot with the identity provider is the same user who is chatting with the bot. This guards against [man-in-the-middle](https://en.wikipedia.org/wiki/Man-in-the-middle_attack) and [phishing](https://en.wikipedia.org/wiki/Phishing) attacks. On the desktop and web versions of Teams, the verification code is generated and verified automatically; on mobile devices the user may have to enter it manually [as described below](#Mobile-clients). ([View code](https://github.com/OfficeDev/microsoft-teams-sample-auth-node/blob/469952a26d618dbf884a3be53c7d921cc580b1e2/src/AuthBot.ts#L100-L113))
9. The OAuth callback renders a page that calls `notifySuccess("<verification code>")`. ([View code](https://github.com/OfficeDev/microsoft-teams-sample-auth-node/blob/master/src/views/oauth-callback-success.hbs))
10. Teams closes the popup and sends the string given to `notifySuccess()` back to the bot. The bot receives an invoke message with `name` = `signin/verifyState`.
10. Teams closes the popup and sends the string given to `notifySuccess()` back to the bot. The bot receives an invoke message with `name = signin/verifyState`.
11. The bot checks the incoming verification code against the code stored in the user's provisional token. ([View code](https://github.com/OfficeDev/microsoft-teams-sample-auth-node/blob/469952a26d618dbf884a3be53c7d921cc580b1e2/src/dialogs/BaseIdentityDialog.ts#L127-L140))
12. If they match, the bot marks the token as validated and ready for use. Otherwise, the auth flow fails, and the bot deletes the provisional token.

## Mobile clients

As of March 2018, the Microsoft Teams mobile clients do not fully support the `signin` action protocol:
As of March 2018, the Microsoft Teams mobile clients do not fully support the signin action protocol:

* If the URL provided to the `signin` button action has a `fallbackUrl` query string parameter, Teams will launch that URL in the browser.
* If the URL provided to the signin button action has a `fallbackUrl` query string parameter, Teams will launch that URL in the browser.
* Otherwise, Teams will show an error saying that the action is not yet supported on mobile.

In the example, the mobile sign in flow works the same way as on the desktop, until the point where the OAuth callback page tries to send the verification code back to the bot. The bot sets the `fallbackUrl` query string parameter to be the same as the original url to the auth start page, so that the user goes to the same page on all platforms. ([View code](https://github.com/OfficeDev/microsoft-teams-sample-auth-node/blob/469952a26d618dbf884a3be53c7d921cc580b1e2/src/dialogs/BaseIdentityDialog.ts#L173-L178))
Expand All @@ -44,7 +44,7 @@ When the OAuth callback runs in a mobile browser, the call to `notifySuccess()`

If you want to limit signing in to web and desktop only, you can choose to omit the `fallbackUrl` parameter, or point it to your own error page that asks the user to sign in on web or desktop.

Once the Microsoft Teams mobile clients support the complete `signin` action protocol, including passing the verification code via `notifySuccess()`, they will launch the auth start page in a popup window and ignore `fallbackUrl`.
Once the Microsoft Teams mobile clients support the complete signin action protocol, including passing the verification code via `notifySuccess()`, they will launch the auth start page in a popup window and ignore `fallbackUrl`.

## Samples

Expand Down
4 changes: 2 additions & 2 deletions msteams-platform/concepts/authentication/auth-tab-AAD.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ This code parses the key-value pairs received from Azure AD in `window.location.

`NotifyFailure()` has the following predefined failure reasons:

* `CancelledByUser` - the user closed the popup window before completing the authentication flow.
* `FailedToOpenWindow` - the popup window could not be opened. When running Microsoft Teams in a browser, this typically means that the window was blocked by a popup blocker.
* `CancelledByUser` the user closed the popup window before completing the authentication flow.
* `FailedToOpenWindow` the popup window could not be opened. When running Microsoft Teams in a browser, this typically means that the window was blocked by a popup blocker.

If successful, you can refresh or reload the page and show content relevant to the now-authenticated user. If authentication fails, display an error message.

Expand Down