-
Notifications
You must be signed in to change notification settings - Fork 27
feat: add filters to support logistration integration #337
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| # 8. The authentication architecture subdomain | ||
|
|
||
| ## Status | ||
|
|
||
| Accepted | ||
|
|
||
| ## Context | ||
|
|
||
| Filters are grouped by architecture subdomain (see | ||
| [ADR-4](0004-filters-naming-and-versioning.rst)). | ||
| Until now, the filters covering how users sign in and register — | ||
| `StudentLoginRequested` and `StudentRegistrationRequested` — have lived in the | ||
| `learning` subdomain, because that was the only user-facing subdomain available | ||
| at the time. | ||
|
|
||
| A new set of filters covering the login and registration *user experience* is | ||
| being introduced: hooks around the login/registration page context and render | ||
| lifecycle, the login and registration form descriptions, the authentication MFE | ||
| (`frontend-app-authn`) context, and the post-login redirect. These needed a | ||
| home, and `learning` is a poor fit: authentication gates access for *every* user | ||
| of the platform — learners and content authors alike — so it is a distinct | ||
| bounded context rather than a learning activity. | ||
|
|
||
| ## Decision | ||
|
|
||
| We will introduce a new "Authentication" architecture subdomain, implemented in | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mariajgrimaldi this makes sense to me, but I'll like to know your thoughs. Should this mean that we also add a similar subdomain in events? |
||
| `openedx_filters/authentication/` with filter types under | ||
| `org.openedx.authentication.*`. From now onward, new authentication-related | ||
| filters should be added here. | ||
|
|
||
| Docs: This new subdomain will be added to the [Architecture Subdomains Reference](../reference/architecture-subdomains.rst) | ||
| alongside "Learning" and "Content Authoring". | ||
|
|
||
| The following filters are added to it: | ||
|
|
||
| - `LogistrationViewContextGenerated` — enrich the legacy (server-rendered) login/registration page context. | ||
| - `LogistrationViewRenderCompleted` — modify the rendered legacy login/registration page response. | ||
| - `AuthnMFEContextGenerated` — enrich the authentication MFE context. | ||
| - `LoginFormGenerated` — augment the generated login form description. | ||
| - `RegistrationFormGenerated` — augment the generated registration form description. | ||
| - `LoginAltRedirectURLRequested` — choose an alternative post-login redirect. | ||
|
|
||
| The diagram below shows when each authn-related filter fires within the authn flow. | ||
|
|
||
| ```mermaid | ||
| flowchart TD | ||
| classDef filter fill:#e8f0fe,stroke:#1a73e8,color:#0a3069 | ||
|
|
||
| ROUTES["/login and /register routes"] | ||
| LEGACY["Legacy logistration view<br/>(server-rendered)"] | ||
| MFE["Authn MFE<br/>(frontend-app-authn)"] | ||
|
|
||
| LogistrationViewContextGenerated["<b>LogistrationViewContextGenerated</b><br/><i>enrich legacy page context</i>"]:::filter | ||
| LogistrationViewRenderCompleted["<b>LogistrationViewRenderCompleted</b><br/><i>post-render response hook,<br/>useful for setting extra cookies</i>"]:::filter | ||
| AuthnMFEContextGenerated["<b>AuthnMFEContextGenerated</b><br/><i>enrich MFE context</i>"]:::filter | ||
| LoginFormGenerated["<b>LoginFormGenerated</b><br/><i>augment login form fields</i>"]:::filter | ||
| RegistrationFormGenerated["<b>RegistrationFormGenerated</b><br/><i>augment registration form fields</i>"]:::filter | ||
| StudentRegistrationRequested["<b>StudentRegistrationRequested</b><br/><i>hook for blocking registration</i>"]:::filter | ||
| StudentLoginRequested["<b>StudentLoginRequested</b><br/><i>hook for blocking login</i>"]:::filter | ||
| LoginAltRedirectURLRequested["<b>LoginAltRedirectURLRequested</b><br/><i>force alternative post-login redirect</i>"]:::filter | ||
|
|
||
| RENDERED["Legacy page rendered"] | ||
| FORMS["Login/registration<br/>FormDescription generation"] | ||
| LOGINPOST["Login POST endpoint"] | ||
| REGPOST["Registration POST endpoint"] | ||
| DEST["Post-auth destination,<br/><i>URL possibly overridden by filter</i>"] | ||
|
|
||
| ROUTES -- "AuthN MFE disabled for flow" --> LEGACY | ||
| ROUTES -- "AuthN MFE enabled for flow" --> MFE | ||
| LEGACY --> LogistrationViewContextGenerated --> RENDERED --> LogistrationViewRenderCompleted | ||
| LogistrationViewRenderCompleted -- "Get FormDescription via python API" --> FORMS | ||
| MFE --> AuthnMFEContextGenerated | ||
| AuthnMFEContextGenerated -- "Get FormDescription via REST API" --> FORMS | ||
| %% invisible edge: pin AuthnMFEContextGenerated to the same rank as | ||
| %% LogistrationViewContextGenerated so both *ContextGenerated filters render on the same level | ||
| AuthnMFEContextGenerated ~~~ RENDERED | ||
| FORMS -- "is /login route" --> LoginFormGenerated | ||
| FORMS -- "is /register route" --> RegistrationFormGenerated | ||
| %% invisible edge: pin LoginFormGenerated to the same rank as | ||
| %% RegistrationFormGenerated so both *FormGenerated filters render on the same level | ||
| LoginFormGenerated ~~~ REGPOST | ||
| LoginFormGenerated -- "submit login" --> LOGINPOST | ||
| RegistrationFormGenerated -- "submit registration" --> REGPOST | ||
| REGPOST --> StudentRegistrationRequested | ||
| LOGINPOST --> StudentLoginRequested | ||
| StudentLoginRequested -- "AuthN MFE enabled and the request is for first-party auth" --> LoginAltRedirectURLRequested | ||
| StudentLoginRequested -- "otherwise" --> DEST | ||
| LoginAltRedirectURLRequested --> DEST | ||
| StudentRegistrationRequested -- "account created and logged in" --> DEST | ||
| ``` | ||
|
|
||
| ## Consequences | ||
|
|
||
| - Future authentication-related filters have a clear, accurately named home and | ||
| no longer need to borrow the "Learning" subdomain. | ||
| - The pre-existing authn filters `StudentLoginRequested` and | ||
| `StudentRegistrationRequested` filters **remain in the `learning` subdomain**. | ||
| They are released, versioned public contracts, and re-homing them would be a | ||
| breaking change for existing consumers. A future major version could migrate | ||
| the two longstanding filters. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| """ | ||
| Filters related to the authentication subdomain. | ||
|
|
||
| The authentication subdomain covers how users sign in, register, and are routed through | ||
| login and registration flows. | ||
| """ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
markdown support for docs is needed because on Github only markdown supports mermaid rendering.