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

Add doc annotation #3530

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a9cf530
added in fragments to read generated json
mooreds Jan 17, 2025
481f771
add in page with the list of user fields indexed and update the cooki…
mooreds Jan 17, 2025
fd9a729
first rev of generated json
mooreds Jan 17, 2025
4c18818
updated index fields display
mooreds Jan 31, 2025
dad4f29
updated index fields display
mooreds Jan 31, 2025
400d25a
updated cookie list to pull only from JSON
mooreds Jan 31, 2025
a960585
add in first rev of generated json
mooreds Jan 31, 2025
13a6a3f
updated to point to the reference documentation
mooreds Jan 31, 2025
25f970e
initial generated json
mooreds Feb 1, 2025
e44db37
add in indexed fields for entities
mooreds Feb 1, 2025
f7c3808
removed unneeded header
mooreds Feb 1, 2025
3426106
changed case of imported json data structure
mooreds Feb 1, 2025
574d2df
wordsmithing, tidying up
mooreds Feb 1, 2025
34bbe20
add in first rev of generated json
mooreds Feb 1, 2025
6142f08
added in authentication types
mooreds Feb 1, 2025
12b1988
add support for 'showSince' attribute.
mooreds Feb 4, 2025
4958ffe
make sure authentication types work well with generated json and the …
mooreds Feb 4, 2025
20103e8
realized that we can pass the showSince version as a normal semver ve…
mooreds Feb 4, 2025
0b63d0c
turning this list into a component to satisfy eslint
mooreds Feb 4, 2025
840c5f2
satsify eslint.
mooreds Feb 4, 2025
271f73a
use new name for version field, to be more consistent
mooreds Feb 20, 2025
9572639
updated name of page to reflect the doc of all cookies
mooreds Feb 24, 2025
690248b
updated persistence per review
mooreds Feb 24, 2025
6835856
new generated json
mooreds Feb 26, 2025
cff427c
pretty print json to reduce future devs eyestrain
mooreds Feb 26, 2025
01b6e88
updated comment
mooreds Feb 26, 2025
0e140f0
Apply suggestions from code review
mooreds Feb 26, 2025
9593ce4
Merge branch 'mooreds/add-doc-annotation' of github.com:FusionAuth/fu…
mooreds Feb 26, 2025
99cb4f7
remove essentially duplicative include files
mooreds Feb 26, 2025
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
29 changes: 27 additions & 2 deletions astro/src/components/api/AvailableSince.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,34 @@ interface Props {
since: string
}
const { since }: Props = Astro.props;
const { since, showSince }: Props = Astro.props;
if (!since) {
throw new Error("No since field");
}
const semverToPaddedNumber = function (semver) {
const [major, minor, patch] = semver.split('.').map(Number);
if (isNaN(major) || isNaN(minor) || isNaN(patch)) {
throw new Error("Invalid semver format");
}
return `${major}${String(minor).padStart(3, '0')}${String(patch).padStart(2, '0')}`;
};
// showSince is a 6 digit number
// the first one is the major version
// the next three are the minor version
// the last two are the patch version
// it is used to only show availableSince on feature doc that were created before this field was added.
// If the field was added before the feature was added, availableSince makes no sense.
// For example, the user.login.suspicious event was added in 1.30.0 and returns an authentication type. But some of those authentication types (Apple) were added before this event was added.
// in this case, we'd provide showSince of 1.30.0 and only authentication types added after 1.30.0 would show the available since value
const alwaysShow = showSince === undefined;
const show = alwaysShow || (semverToPaddedNumber(since) > semverToPaddedNumber(showSince));
---
<span class='text-green-500 text-sm italic'>Available since {since}</span>
<span class='text-green-500 text-sm italic'>{show ? 'Available since ' + since : ''</span>
4 changes: 2 additions & 2 deletions astro/src/content/docs/_shared/_access-token-claims.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import APIBlock from 'src/components/api/APIBlock.astro';
import APIField from 'src/components/api/APIField.astro';
import AuthenticationTypeClaimValues from 'src/content/docs/_shared/_authentication-type-values.mdx';
import AuthenticationTypeValues from 'src/content/docs/_shared/authentication-type-values.astro';
import InlineField from 'src/components/InlineField.astro';
import RemovedSince from 'src/components/api/RemovedSince.astro';

Expand All @@ -20,7 +20,7 @@ import RemovedSince from 'src/components/api/RemovedSince.astro';
<APIField name="authenticationType" type="String">
The method used to authenticate the User which resulted in this JWT being generated. The possible values are:

<AuthenticationTypeClaimValues show_since="100000" />
<AuthenticationTypeValues />
</APIField>
<APIField name="auth_time" type="Long" since="1.36.0">
The time of the initial authentication request, expressed as UNIX time which is the number of seconds since Epoch. This claim will remain the same even when the token has been re-issued through the use of a Refresh Token.
Expand Down
37 changes: 0 additions & 37 deletions astro/src/content/docs/_shared/_authentication-type-values.mdx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import APIField from 'src/components/api/APIField.astro';

<APIBlock>
<APIField name="app.at" type="String">
The encoded access token. This cookie is written in the response as a `Secure` `HttpOnly` session cookie.
The encoded access token. This cookie is written in the response as a `Secure` `HttpOnly` persistent cookie.
</APIField>
<APIField name="app.rt" type="String">
The refresh token. This cookie is written in the response as a `Secure` `HttpOnly` persistent cookie. The cookie expiration is configured in the JWT
Expand Down
15 changes: 15 additions & 0 deletions astro/src/content/docs/_shared/authentication-type-values.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
import AvailableSince from 'src/components/api/AvailableSince.astro';
import AuthenticationTypes from 'src/content/json/generated/authenticationtype.json';
import { parseInline } from 'marked';

const { showSince } = Astro.props;
---

<ul>
{AuthenticationTypes.map((type) =>
<li>
<code>{type.name}</code> - <span set:html={parseInline(type.description)}/> {type.since ? <AvailableSince showSince={showSince} since={type.since} /> : "" }
</li>
)}
</ul>
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ import SearchPreprocessingWarning from "src/content/docs/_shared/_search-preproc
</p>

<p>
You may search against specific fields like so: <code>email:*fusionauth.io</code>. This will match only users with a <code>fusionauth.io</code> email address. You may find the available fields for matching by retrieving the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/6.3/indices-get-mapping.html">Elasticsearch mapping</a>.
You may search against specific fields like so: <code>email:*fusionauth.io</code>. This will match only users with a <code>fusionauth.io</code> email address. Here are <a href='/docs/reference/user-fields'>the available fields for matching</a>.
</p>

<SearchPreprocessingWarning/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ import SearchPreprocessingWarning from "src/content/docs/_shared/_search-preproc

The match is case-insensitive. Whitespace is allowed in the search, but must be URL escaped; for example, using `%20` for a space character. Elasticsearch compatible regular expressions may be used, so you may search by prefix or suffix using the `*` wildcard.

You may search against specific fields like so: `name:*API`. This will match only entities with a name ending in a `API`. You may find the available fields for matching by retrieving the [Elasticsearch mapping](https://www.elastic.co/guide/en/elasticsearch/reference/6.3/indices-get-mapping.html).
You may search against specific fields like so: `name:*API`. This will match only entities with a name ending in a `API`. Here are [the available fields for matching](/docs/reference/user-fields).

<SearchPreprocessingWarning/>
</APIField>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ section: extend
subcategory: code
tertcategory: lambdas
---
import AuthenticationTypeValues from 'src/content/docs/_shared/_authentication-type-values.mdx';
import AuthenticationTypeValues from 'src/content/docs/_shared/authentication-type-values.astro';
import Breadcrumb from 'src/components/Breadcrumb.astro';
import InlineField from 'src/components/InlineField.astro';

Expand Down Expand Up @@ -48,7 +48,7 @@ The `result` object contains an [Errors](/docs/apis/errors) object. The `user` a

`authenticationtype` is the method used to authenticate the user. The possible values are:

<AuthenticationTypeValues show_since="105300" />
<AuthenticationTypeValues showSince="1.53.0" />

The `identityProvider` object in the `context` will only be present when the login request is from a 3rd party Identity Provider.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ subcategory: events and webhooks
tertcategory: events
---
import APIField from 'src/components/api/APIField.astro';
import AuthenticationTypeValues from 'src/content/docs/_shared/_authentication-type-values.mdx';
import AuthenticationTypeValues from 'src/content/docs/_shared/authentication-type-values.astro';
import Event from 'src/content/docs/extend/events-and-webhooks/events/_event.astro';
import EventBody from 'src/content/docs/extend/events-and-webhooks/events/_event-body.astro';
import InlineField from 'src/components/InlineField.astro';
Expand All @@ -33,7 +33,7 @@ export const eventType = 'user.login.failed';
<APIField slot="leading-fields" name="event.authenticationType" type="String">
The type of authentication used in the login request. The possible values are:

<AuthenticationTypeValues show_since="100600" />
<AuthenticationTypeValues showSince="1.6.0" />
</APIField>

<APIField slot="leading-fields" name="event.createInstant" type="Long">
Expand Down Expand Up @@ -78,7 +78,7 @@ export const eventType = 'user.login.failed';
</APIField>

<APIField slot="trailing-fields" name="event.type" type="String">
The event type, this value will always be <code>{eventType}</code>.
The event type, this value will always be <code>{eventType}</code>.{/* eslint-disable-line */}
</APIField>

<APIField slot="trailing-fields" name="event.user" type="Object">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ subcategory: events and webhooks
tertcategory: events
---
import APIField from 'src/components/api/APIField.astro';
import AuthenticationTypeValues from 'src/content/docs/_shared/_authentication-type-values.mdx';
import AuthenticationTypeValues from 'src/content/docs/_shared/authentication-type-values.astro';
import Event from 'src/content/docs/extend/events-and-webhooks/events/_event.astro';
import EventBody from 'src/content/docs/extend/events-and-webhooks/events/_event-body.astro';
import InlineField from 'src/components/InlineField.astro';
Expand Down Expand Up @@ -34,7 +34,7 @@ export const eventType = 'user.login.new-device';
<APIField slot="leading-fields" name="event.authenticationType" type="String">
The type of authentication used in the login request. The possible values are:

<AuthenticationTypeValues show_since="103000" />
<AuthenticationTypeValues showSince="1.30.0" />
</APIField>

<APIField slot="leading-fields" name="event.connectorId" type="UUID">
Expand Down Expand Up @@ -62,7 +62,7 @@ export const eventType = 'user.login.new-device';
</APIField>

<APIField slot="leading-fields" name="event.type" type="String">
The event type, this value will always be <code>{eventType}</code>.
The event type, this value will always be <code>{eventType}</code>.{/* eslint-disable-line */}
</APIField>

<APIField slot="leading-fields" name="event.user" type="Object">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ subcategory: events and webhooks
tertcategory: events
---
import APIField from 'src/components/api/APIField.astro';
import AuthenticationTypeValues from 'src/content/docs/_shared/_authentication-type-values.mdx';
import AuthenticationTypeValues from 'src/content/docs/_shared/authentication-type-values.astro';
import Event from 'src/content/docs/extend/events-and-webhooks/events/_event.astro';
import EventBody from 'src/content/docs/extend/events-and-webhooks/events/_event-body.astro';
import InlineField from 'src/components/InlineField.astro';
Expand All @@ -33,7 +33,7 @@ export const eventType = 'user.login.success';
<APIField slot="leading-fields" name="event.authenticationType" type="String">
The type of authentication used in the login request. The possible values are:

<AuthenticationTypeValues show_since="100600" />
<AuthenticationTypeValues showSince="1.6.0" />
</APIField>

<APIField slot="leading-fields" name="event.connectorId" type="UUID" since="1.18.0">
Expand Down Expand Up @@ -67,7 +67,7 @@ export const eventType = 'user.login.success';
</APIField>

<APIField slot="trailing-fields" name="event.type" type="String">
The event type, this value will always be <code>{eventType}</code>.
The event type, this value will always be <code>{eventType}</code>.{/* eslint-disable-line */}
</APIField>

<APIField slot="trailing-fields" name="event.user" type="Object">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ subcategory: events and webhooks
tertcategory: events
---
import APIField from 'src/components/api/APIField.astro';
import AuthenticationTypeValues from 'src/content/docs/_shared/_authentication-type-values.mdx';
import AuthenticationTypeValues from 'src/content/docs/_shared/authentication-type-values.astro';
import Event from 'src/content/docs/extend/events-and-webhooks/events/_event.astro';
import EventBody from 'src/content/docs/extend/events-and-webhooks/events/_event-body.astro';
import InlineField from 'src/components/InlineField.astro';
Expand Down Expand Up @@ -34,7 +34,7 @@ export const eventType = 'user.login.suspicious';
<APIField slot="leading-fields" name="event.authenticationType" type="String">
The type of authentication used in the login request. The possible values are:

<AuthenticationTypeValues show_since="103000" />
<AuthenticationTypeValues showSince="1.30.0" />
</APIField>

<APIField slot="leading-fields" name="event.connectorId" type="UUID">
Expand Down Expand Up @@ -70,7 +70,7 @@ export const eventType = 'user.login.suspicious';
</APIField>

<APIField slot="trailing-fields" name="event.type" type="String">
The event type, this value will always be <code>{eventType}</code>.
The event type, this value will always be <code>{eventType}</code>.{/* eslint-disable-line */}
</APIField>

<APIField slot="trailing-fields" name="event.user" type="Object">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import APIBlock from 'src/components/api/APIBlock.astro';
import APIField from 'src/components/api/APIField.astro';
import AccessTokenClaims from 'src/content/docs/_shared/_access-token-claims.mdx';
import Aside from 'src/components/Aside.astro';
import AuthenticationTypeClaimValues from 'src/content/docs/_shared/_authentication-type-values.mdx';
import AuthenticationTypeValues from 'src/content/docs/_shared/authentication-type-values.astro';
import Breadcrumb from 'src/components/Breadcrumb.astro';
import ExampleAccessToken from 'src/content/docs/lifecycle/authenticate-users/oauth/_example_access_token.mdx';
import ExampleIdToken from 'src/content/docs/lifecycle/authenticate-users/oauth/_example_id_token.mdx';
import ExampleRefreshToken from 'src/content/docs/lifecycle/authenticate-users/oauth/_example_refresh_token.mdx';
Expand Down Expand Up @@ -149,7 +150,7 @@ The Id Token may be returned as part of an Authentication request when the `open
<APIField name="authenticationType" type="String">
The method used to authenticate the User which resulted in this JWT being generated. The possible values are:

<AuthenticationTypeClaimValues show_since="100000" />
<AuthenticationTypeValues />
</APIField>
<APIField name="auth_time" type="Long" since="1.36.0">
The time of the initial authentication request expressed as UNIX time which is the number of seconds since Epoch. This claim will remain the same even when the token has been re-issued through the use of a Refresh Token.
Expand Down Expand Up @@ -263,7 +264,7 @@ A refresh token is associated with the same set of validated and consented OAuth

To request a refresh token during authentication you must provide the `offline_access` scope. The refresh token is not supported by the Implicit Grant, so if you provide the `offline_access` scope during an Implicit Grant workflow it will be ignored.

If you request the `offline_access` scope and an Refresh Token is not returned, ensure that the FusionAuth application has been configured to generate refresh tokens. Ensure `Generate refresh tokens` is enabled in your application settings. See <strong>Settings -> Applications -> OAuth</strong>. This setting will cause a Refresh Token to be returned when the `offline_access` scope is requested. You will also want to ensure the `Refresh Token` grant is enabled which allows the use of the Refresh Token to be exchanged for a new Access Token.
If you request the `offline_access` scope and an Refresh Token is not returned, ensure that the FusionAuth application has been configured to generate refresh tokens. Ensure `Generate refresh tokens` is enabled in your application settings. See <Breadcrumb>Settings -> Applications -> OAuth</Breadcrumb>. This setting will cause a Refresh Token to be returned when the `offline_access` scope is requested. You will also want to ensure the `Refresh Token` grant is enabled which allows the use of the Refresh Token to be exchanged for a new Access Token.

### Sample Refresh Token

Expand Down
Loading