Skip to content

Adding a skill to create a first class skill covering all of Form.io authentication and authorization.#7

Open
travist wants to merge 6 commits into
mainfrom
formio-auth-skill
Open

Adding a skill to create a first class skill covering all of Form.io authentication and authorization.#7
travist wants to merge 6 commits into
mainfrom
formio-auth-skill

Conversation

@travist
Copy link
Copy Markdown
Member

@travist travist commented May 22, 2026

This PR separates out the Form.io authentication and authorization away from the formio-resource-planner skill into its own first class skill to describe the many methods of authentication and authorization within a Form.io application. It also incorporates a coordination between the formio-resource-planner since a big part of that skill is the setup of users and groups to achieve a certain application goal.

@blakekrammes blakekrammes self-requested a review May 26, 2026 15:58
Copy link
Copy Markdown
Contributor

@blakekrammes blakekrammes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good overall! I think the OIDC comments should be addressed (also the SAML comment). Some of the other suggestions are more minor.

Comment thread packages/mcp-server/src/__tests__/formio-auth-skill.test.ts Outdated
Comment thread plugin/skills/formio-auth/references/custom-jwt.md Outdated
Comment thread plugin/skills/formio-auth/references/custom-jwt.md Outdated
Comment thread plugin/skills/formio-auth/references/custom-jwt.md
Comment thread plugin/skills/formio-auth/references/email-auth.md Outdated
Comment thread plugin/skills/formio-auth/references/token-swap.md Outdated
Comment thread plugin/skills/formio-auth/references/token-swap.md Outdated
Comment thread plugin/skills/formio-auth/references/token-swap.md Outdated
Comment thread plugin/skills/formio-auth/references/token-swap.md Outdated
Comment thread plugin/skills/formio-auth/references/token-swap.md Outdated
Comment thread plugin/skills/formio-auth/references/email-auth.md Outdated
Comment thread plugin/skills/formio-auth/references/email-auth.md Outdated
Comment thread plugin/skills/formio-auth/references/jwt-and-sessions.md Outdated
Comment thread plugin/skills/formio-auth/references/jwt-and-sessions.md Outdated
Comment thread plugin/skills/formio-auth/references/sso-oidc.md Outdated
Comment thread plugin/skills/formio-auth/references/sso-oidc.md Outdated
Comment thread plugin/skills/formio-auth/references/sso-oidc.md Outdated
Comment thread plugin/skills/formio-auth/references/token-swap.md Outdated
Comment thread plugin/skills/formio-auth/references/token-swap.md Outdated
Comment thread plugin/skills/formio-auth/references/sso-oidc.md Outdated

Claim semantics:

- `user._id` — MongoDB ID of the user submission when the identity is backed by a `user` Resource row (Resource login). For SSO (Remote Authentication) and Custom JWTs there is no Resource row — the user is ephemeral and `user._id` is either an IDP id (for SSO), or the `"external"` sentinel for Custom JWTs.
Copy link
Copy Markdown
Contributor

@blakekrammes blakekrammes May 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `user._id` — MongoDB ID of the user submission when the identity is backed by a `user` Resource row (Resource login). For SSO (Remote Authentication) and Custom JWTs there is no Resource row — the user is ephemeral and `user._id` is either an IDP id (for SSO), or the `"external"` sentinel for Custom JWTs.
- `user._id` — MongoDB ID of the user submission when the identity is backed by a `user` Resource row (Resource login). For SSO (Remote Authentication) and Custom JWTs there is no Resource row — the user is ephemeral and `user._id` is either a literal IDP id (or derived from one) for SSO, or the `"external"` sentinel for Custom JWTs.

maybe too much in the weeds, but we don't use the direct sub (or custom id path) claim for OIDC for instance, but instead encode a truncated form of it in a mongo id.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will change "id" to say "identifier" so we are purposefully vague on what we are using.

- `settings.provider` = "openid"
- `settings.association` = "remote"
- `settings.button` = "oidcLogin" <== Must match the key for the OIDC login button component.
- `settings.redirectURI` = "..." <== The application url to navigate to after the OIDC handshake.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `settings.redirectURI` = "..." <== The application url to navigate to after the OIDC handshake.
- `settings.redirectURI` = "..." <== The application url to navigate to after the OIDC handshake (defaults to `window.location.origin` of the application).

- Issuing a Form.io JWT entirely from your own backend without an IdP at all → see [`custom-jwt.md`](./custom-jwt.md).

## Configuration
In order to perform a token swap, the projects OpenID settings must be configured. See [`sso-oidc.md`](./sso-oidc.md) for instructions on these configurations.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In order to perform a token swap, the projects OpenID settings must be configured. See [`sso-oidc.md`](./sso-oidc.md) for instructions on these configurations.
In order to perform a token swap, the project's OpenID settings must be configured. See [`sso-oidc.md`](./sso-oidc.md) for instructions on these configurations.

## Configuration
In order to perform a token swap, the projects OpenID settings must be configured. See [`sso-oidc.md`](./sso-oidc.md) for instructions on these configurations.

**Import: You must also ensure you have the role mappings configured within the project settings to properly map the OIDC claims with the Form.io Roles.**
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Import: You must also ensure you have the role mappings configured within the project settings to properly map the OIDC claims with the Form.io Roles.**
**Important: You must also ensure you have the role mappings configured within the project settings to properly map the OIDC claims with the Form.io Roles.**

With these settings in place, and saved within the OAuth Action, when a user is using the form (embedded within the application), and clicks on the button, the following occurs.

1. User is redirected to IDP authentication page and logs in.
2. IDP auth performs a redirect to the login form endpoint with access tokens in query params
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. IDP auth performs a redirect to the login form endpoint with access tokens in query params
2. IDP auth performs a redirect to `settings.redirectURI` with the access and id tokens in query params

I think saying redirect to the login form could lead the agent to assume that the login form's API endpoint is the callback/redirect uri.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the login form endpoint that it redirects to... Correct me if I am wrong but I think the flow is the following.

  • User clicks button
  • Application opens up IDP authorize page.
  • After the user logs in, the IDP auth page sends the browser to the 'server-side' callback url with token
  • Server side processing occurs with the token, gets the user info
  • Server then uses the 'redirectURI' to perform a 301 redirect to that url with jwt-token in header to set token.
  • User sees the application go to the url and they have the token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants