Skip to content

docs(security): document a providers function for providers created at runtime - #3620

Open
kamilmysliwiec wants to merge 1 commit into
masterfrom
docs/oidc-providers-function
Open

kamilmysliwiec wants to merge 1 commit into
masterfrom
docs/oidc-providers-function

Conversation

@kamilmysliwiec

Copy link
Copy Markdown
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Docs
  • Other... Please describe:

What is the current behavior?

Issue Number: nestjs/authentication#48

The "Sign in with Google" section documents oidc.providers only as a record fixed at startup.

What is the new behavior?

Documents the function form of oidc.providers that nestjs/authentication#52 adds, for providers created at runtime (one OIDC client per customer, stored in the database):

  • An example after the callbackUrl function paragraph, at the end of the "Sign in with Google" section. It uses forRootAsync() with inject to reach the app's repository, and returns undefined (a 404) for a name the app doesn't serve.
  • How it behaves:
    • It is called on the login and again on the callback, so a rotated secret is used from the next call on.
    • Each returned configuration gets the startup checks.
    • The lookup is the app's to cache, while discovery documents and keys are cached by issuer.
  • Each name must stand for one client of one provider, since identities are linked by (provider, subject): put the customer in the name rather than reusing one name for every customer's provider.
  • Two hazards when customers bring their own identity provider:
    • Linking by verified email has to stay within that customer's accounts.
    • The issuer is user input, to check against supported providers before storing it.
  • The oidc.providers row of the options table mentions the function.

npm run docs-only and ng build pass locally.

Does this PR introduce a breaking change?

  • Yes
  • No

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.

1 participant