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

Logout and session management doc #3148

Merged
merged 43 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
ebfc13d
updated to add breadcrumb
mooreds May 2, 2024
94425c0
note about api/logout
mooreds Jun 24, 2024
43a2871
diagrams for logout guide
mooreds Jul 1, 2024
dacdead
initial draft of logout and session management doc
mooreds Jul 1, 2024
b2cc276
more flavor around the PING authenticationType
mooreds Jul 1, 2024
ca7e432
added images and sample json responses
mooreds Jul 2, 2024
117abb7
moved session details section to the lifecycle logut/session doc
mooreds Jul 2, 2024
aabdc86
added some links to the api docs for the logout guide
mooreds Jul 2, 2024
a56dbaf
Merge branch 'main' into mooreds/add-logout-doc
mooreds Jul 2, 2024
addb906
adding another screenshot
mooreds Jul 2, 2024
42a5ce2
add link to logout guide
mooreds Jul 2, 2024
98e0858
another diagram around invalid sessions
mooreds Jul 3, 2024
78135d3
another read through
mooreds Jul 3, 2024
cbad982
remove application id, if it is supposed to represent the SSO session
mooreds Jul 3, 2024
0445d15
some comments, still wip
mooreds Jul 11, 2024
992362c
removed some todos
mooreds Jul 12, 2024
a51df46
Merge branch 'main' into mooreds/add-logout-doc
mooreds Jul 12, 2024
2b8cf14
added expiration table from sso guide to logout guide, reworked some …
mooreds Jul 12, 2024
680a6a3
more work on this doc
mooreds Jul 12, 2024
89f2113
checked inline ui element
mooreds Jul 12, 2024
141dde9
fixing spelling typos
mooreds Jul 12, 2024
8ea131b
adding new name to known words
mooreds Jul 12, 2024
0f180b1
adding new word to known words
mooreds Jul 12, 2024
3e29d03
fixing spelling typos
mooreds Jul 12, 2024
98e3c20
Merge branch 'main' into mooreds/add-logout-doc
mooreds Jul 15, 2024
21a2f83
add in account logout considerations
mooreds Jul 15, 2024
e944bc6
readthrough
mooreds Jul 30, 2024
361a52f
Shrink images
mooreds Jul 30, 2024
a253bc0
final content added about jwt sessions
mooreds Jul 30, 2024
690433b
spellcheck
mooreds Jul 30, 2024
f3c45f3
Merge branch 'main' into mooreds/add-logout-doc
mooreds Jul 30, 2024
6253e2a
Shrink images
mooreds Jul 30, 2024
df64a19
Merge branch 'main' into mooreds/add-logout-doc
mooreds Aug 7, 2024
c2b3363
remove centralized sessions example from the ignored list
mooreds Aug 7, 2024
5cb511c
Merge branch 'mooreds/add-logout-doc' of github.com:FusionAuth/fusion…
mooreds Aug 7, 2024
0b06e85
Merge branch 'main' into mooreds/add-logout-doc
mooreds Aug 15, 2024
759febb
added redis
mooreds Aug 15, 2024
bd481fe
wordsmithing changes from PR review
mooreds Aug 15, 2024
c033e43
Shrink images
mooreds Aug 15, 2024
8adb65a
fixed merge issue
mooreds Aug 16, 2024
2ce2d94
Shrink images
mooreds Aug 16, 2024
083d548
removed metadata.device content
mooreds Aug 16, 2024
fc8a293
Merge branch 'mooreds/add-logout-doc' of github.com:FusionAuth/fusion…
mooreds Aug 16, 2024
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* `OPENID_CONNECT` - The User was authenticated using an external OpenID Connect provider. <span class="text-green-500">Available since 1.1.0</span>
* `PASSWORD` - The User was authenticated using a loginId and password combination.
* `PASSWORDLESS` - The user was authenticated using a passwordless login link. &nbsp; <span class="text-green-500">Available since 1.5.0</span>
* `PING` - The user was authenticated using a `PUT` request on the Login API. This is used to record a login event without prompting for credentials.
* `PING` - The user was authenticated using a `PUT` request on the Login API. This is used to record a login event without prompting for credentials, such as when the FusionAuth SSO session is used.
* `REFRESH_TOKEN` - The User requested a new JWT using a Refresh Token.
* `REGISTRATION` - The user was created using the Registration API. &nbsp; <span class="text-green-500">Available since 1.16.0</span>
* `SAMLv2` - The User was authenticated using an external SAMLv2 provider. <span class="text-green-500">Available since 1.6.0</span>
Expand Down
6 changes: 6 additions & 0 deletions astro/src/content/docs/apis/jwt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ This API has been available since 1.8.0

## Refresh a JWT

This can be used to extend a centrally managed session when a refresh token represents a user session. [Learn more about using refresh tokens to model sessions](/docs/lifecycle/authenticate-users/logout-session-management).

### Request

<API method="POST" uri="/api/jwt/refresh" authentication={["none"]} title="Request a new Access Token by presenting a valid Refresh Token."/>
Expand Down Expand Up @@ -287,6 +289,8 @@ Cookie: refresh_token=xRxGGEpVawiUak6He367W3oeOfh+3irw+1G1h1jc; access_token=eyJ

## Retrieve Refresh Tokens

This can be used to examine a centrally managed session when the refresh token represents a user session. [Learn more about using refresh tokens to model sessions](/docs/lifecycle/authenticate-users/logout-session-management).

### Request

<API method="GET" uri="/api/jwt/refresh/{tokenId}" authentication={["api-key"]} title="Retrieve a Single Refresh Token"/>
Expand Down Expand Up @@ -327,6 +331,8 @@ Cookie: refresh_token=xRxGGEpVawiUak6He367W3oeOfh+3irw+1G1h1jc; access_token=eyJ

## Revoke Refresh Tokens

This can be used to revoke a centrally managed session, when the refresh token is being used to model a session. [Learn more about using refresh tokens to model sessions](/docs/lifecycle/authenticate-users/logout-session-management).
mooreds marked this conversation as resolved.
Show resolved Hide resolved

### Request

<API method="DELETE" uri="/api/jwt/refresh?applicationId={applicationId}" authentication={["api-key"]} title="Revoke all Refresh Tokens for an entire Application"/>
Expand Down
4 changes: 3 additions & 1 deletion astro/src/content/docs/apis/login.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,9 @@ _Response Codes_
The Logout API is intended to be used to remove the refresh token and access token cookies if they exist on the client and revoke the refresh token. This
API does nothing if the request does not contain an access token or refresh token cookies.

The refresh token is only revoked if the request contains the `refresh_token` cookie or the `refreshToken` request parameter.
The refresh token is only revoked if the request contains the `refresh_token` cookie or the `refreshToken` request parameter.

This does not revoke the FusionAuth SSO session. Use [`/oauth2/logout`](/docs/lifecycle/authenticate-users/oauth/endpoints#logout) to do so.

### Request

Expand Down
24 changes: 2 additions & 22 deletions astro/src/content/docs/get-started/core-concepts/users.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ Learn more about [Family API with Consents](/blog/2023/06/13/modeling-family-and

### Sessions

Users have sessions in FusionAuth. Sessions are equivalent to refresh tokens. Their lifetime is controlled by the tenant or application refresh token settings.
Users have sessions in FusionAuth. Sessions are represented by refresh tokens. Their lifetime is controlled by the tenant or application refresh token settings.

These appear in the administrative user interface under the <strong>Sessions</strong> tab (you may need to scroll if your screen is small):

Expand All @@ -512,27 +512,7 @@ There are two primary types of sessions/tokens shown in this table:
With <InlineUIElement>Delete all sessions</InlineUIElement> button, you can revoke all sessions for a user.
This is useful if you want to force a user to log in again.

#### Session Details

A session can be created by using the Login API, as long as <InlineField>[Generate refresh tokens](/docs/get-started/core-concepts/applications#security)</InlineField> is enabled, or by completing the [OAuth Authorization Code grant](/docs/lifecycle/authenticate-users/oauth/#example-authorization-code-grant) when the `offline_access` scope is requested.

A session will end when:

* It expires.
* It is deleted using the [JWT APIs](/docs/apis/jwt#revoke-refresh-tokens).
* Optionally, as a result of a user changing their password or having their account locked.

These can be configured in the [Tenant Refresh Token settings](/docs/get-started/core-concepts/tenants#jwt) or the [Application Refresh Token settings](/docs/get-started/core-concepts/applications#jwt).

An SSO session will end if you log out of SSO.

<Aside type="note">
Normal sessions are not ended, nor are associated refresh tokens revoked, by [front channel logout](/docs/lifecycle/authenticate-users/oauth/endpoints#logout).
</Aside>

When a session is no longer valid, the associated refresh token can't be used to create new JWTs.

The JWTs themselves are valid until they expire.
[Learn more about sessions and logging out](/docs/lifecycle/authenticate-users/logout-session-management).

#### Table Columns

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Breadcrumb from 'src/components/Breadcrumb.astro';
import InlineField from 'src/components/InlineField.astro';

The single sign-on session duration can be configured at the Tenant level. Navigate to <Breadcrumb>Tenant -> Your Tenant -> OAuth</Breadcrumb> and edit the <InlineField>Session timeout</InlineField> value. Because this value is shared between applications, it can't be overridden in application configuration.

<img src="/img/docs/lifecycle/authenticate-users/tenant-single-sign-on-session-timeout.png" alt="Configuring the single sign-on session length." width="1200" role="bottom-cropped" />

The length of a single sign-on session can be different from the session length for individual applications. When a request to an application occurs, there are four possible scenarios:

*Single sign-on session scenarios*

| Application Session | FusionAuth Session | Result |
|---------------------|--------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| valid | valid | Application serves request. |
| valid | expired | Application serves request. |
| expired | valid | Application redirects to FusionAuth, which redirects back to the application. The application then adds the user to the session and serves the request. |
| expired | expired | The user must authenticate with FusionAuth. On successful authentication, FusionAuth redirects back to the application. The application then adds the user to the session and serves the request. |

Loading
Loading