@openedx/frontend-app-authn 1.0.0 → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.rst +263 -109
- package/package.json +1 -1
package/README.rst
CHANGED
|
@@ -2,116 +2,198 @@
|
|
|
2
2
|
frontend-app-authn
|
|
3
3
|
##################
|
|
4
4
|
|
|
5
|
-
|
|
|
5
|
+
|license-badge| |status-badge| |ci-badge| |codecov-badge| |semantic-release|
|
|
6
|
+
|
|
7
|
+
Authn is a `frontend-base`_ application: a library that plugs into the Open edX
|
|
8
|
+
frontend shell, rather than a standalone micro-frontend bundled with its own
|
|
9
|
+
webpack build.
|
|
10
|
+
|
|
11
|
+
.. _frontend-base: https://github.com/openedx/frontend-base
|
|
6
12
|
|
|
7
13
|
********
|
|
8
14
|
Purpose
|
|
9
15
|
********
|
|
10
16
|
|
|
11
|
-
This is
|
|
12
|
-
|
|
13
|
-
**What is the domain of this MFE?**
|
|
17
|
+
This app is responsible for the login, registration and password reset
|
|
18
|
+
functionality, and serves:
|
|
14
19
|
|
|
15
20
|
- Register page
|
|
16
|
-
|
|
17
21
|
- Login page
|
|
18
|
-
|
|
19
22
|
- Forgot password page
|
|
20
|
-
|
|
21
23
|
- Reset password page
|
|
22
|
-
|
|
23
24
|
- Progressive profiling page
|
|
24
25
|
|
|
26
|
+
*********************
|
|
27
|
+
Branches and Releases
|
|
28
|
+
*********************
|
|
29
|
+
|
|
30
|
+
This app is published to NPM by ``semantic-release``, and its branches follow
|
|
31
|
+
`OEP-10 ADR 0002`_:
|
|
32
|
+
|
|
33
|
+
``master``
|
|
34
|
+
Unstable. Every merge publishes a prerelease on the ``alpha`` dist-tag.
|
|
35
|
+
Breaking changes land here with no DEPR process and no warning, so it is not
|
|
36
|
+
supported in production. All changes, including bug fixes, should target this
|
|
37
|
+
branch first.
|
|
38
|
+
|
|
39
|
+
``stable``
|
|
40
|
+
Carries the newest stable major and owns the ``latest`` dist-tag. Changes
|
|
41
|
+
arrive here as backports from ``master``, and no breaking change lands after
|
|
42
|
+
publication.
|
|
43
|
+
|
|
44
|
+
``n.x`` and ``n.m.x``
|
|
45
|
+
Maintenance branches for majors and minors that ``stable`` has moved past.
|
|
46
|
+
Each owns the dist-tag matching its own name, so consumers select a maintained
|
|
47
|
+
line by semver range, e.g. ``"1.x"``.
|
|
48
|
+
|
|
49
|
+
``stable`` is cut, and ``1.0.0`` is the current stable release. Both
|
|
50
|
+
``.releaserc`` and the ``Release CI`` workflow know the whole layout, including
|
|
51
|
+
the maintenance branch patterns, so a new line starts publishing as soon as it
|
|
52
|
+
is pushed.
|
|
53
|
+
|
|
54
|
+
This repository is no longer branched or tagged for Open edX releases in its own
|
|
55
|
+
right. It participates by published version instead, per `OEP-10 ADR 0003`_.
|
|
56
|
+
|
|
57
|
+
The micro-frontend this app replaces goes on living on `legacy-mfe`_, which is
|
|
58
|
+
where any further ``release/RELEASENAME`` branches for it are cut, for as long as
|
|
59
|
+
a supported release still ships it. Teak, Ulmo and Verawood all do.
|
|
60
|
+
|
|
61
|
+
.. _OEP-10 ADR 0002: https://docs.openedx.org/projects/openedx-proposals/en/latest/processes/oep-0010/decisions/0002-frontend-stable-branches.html
|
|
62
|
+
.. _OEP-10 ADR 0003: https://docs.openedx.org/projects/openedx-proposals/en/latest/processes/oep-0010/decisions/0003-frontend-release-strategy.html
|
|
63
|
+
.. _legacy-mfe: https://github.com/openedx/frontend-app-authn/tree/legacy-mfe
|
|
64
|
+
|
|
25
65
|
***************
|
|
26
66
|
Getting Started
|
|
27
67
|
***************
|
|
28
68
|
|
|
29
|
-
|
|
30
|
-
|
|
69
|
+
Prerequisites
|
|
70
|
+
=============
|
|
31
71
|
|
|
32
|
-
|
|
72
|
+
A running Open edX instance is needed to serve this app's backend APIs.
|
|
73
|
+
`Tutor`_ in development mode is the usual choice, and ``site.config.dev.tsx``
|
|
74
|
+
already points at its default hostnames.
|
|
75
|
+
|
|
76
|
+
Unlike a micro-frontend, this app is neither built nor served by ``tutor-mfe``.
|
|
77
|
+
The dev server below runs on the host. Note that ``tutor-mfe`` v22 and later do
|
|
78
|
+
ship this app as a frontend-base application for *deployment*, disabled by
|
|
79
|
+
default; see `Frontend apps`_ in its README to enable it.
|
|
33
80
|
|
|
34
81
|
.. _Tutor: https://github.com/overhangio/tutor
|
|
35
|
-
..
|
|
82
|
+
.. _Frontend apps: https://github.com/overhangio/tutor-mfe#frontend-apps
|
|
36
83
|
|
|
37
|
-
|
|
38
|
-
|
|
84
|
+
Cloning and Startup
|
|
85
|
+
===================
|
|
39
86
|
|
|
40
|
-
|
|
87
|
+
1. Clone the repo:
|
|
41
88
|
|
|
42
|
-
|
|
89
|
+
``git clone https://github.com/openedx/frontend-app-authn.git``
|
|
43
90
|
|
|
44
|
-
|
|
45
|
-
:widths: 30 50 20
|
|
46
|
-
:header-rows: 1
|
|
91
|
+
2. Use the version of Node specified in the ``.nvmrc`` file.
|
|
47
92
|
|
|
48
|
-
*
|
|
49
|
-
|
|
50
|
-
|
|
93
|
+
Using other major versions of Node *may* work, but is unsupported. This
|
|
94
|
+
repository includes an ``.nvmrc`` file to help set the correct Node version
|
|
95
|
+
via `nvm <https://github.com/nvm-sh/nvm>`_.
|
|
51
96
|
|
|
52
|
-
|
|
53
|
-
- The fully-qualified URL to the login issue support page in the target environment.
|
|
54
|
-
- ``https://support.example.com``
|
|
97
|
+
3. Install npm dependencies:
|
|
55
98
|
|
|
56
|
-
|
|
57
|
-
- The fully-qualified URL to the activation email support page in the target environment.
|
|
58
|
-
- ``https://support.example.com``
|
|
99
|
+
``cd frontend-app-authn && npm install``
|
|
59
100
|
|
|
60
|
-
|
|
61
|
-
- The fully-qualified URL to the password reset support page in the target environment.
|
|
62
|
-
- ``https://support.example.com``
|
|
101
|
+
4. Start the dev server:
|
|
63
102
|
|
|
64
|
-
|
|
65
|
-
- The fully-qualified URL to the progressive profiling support page in the target environment.
|
|
66
|
-
- ``https://support.example.com``
|
|
103
|
+
``npm run dev``
|
|
67
104
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
105
|
+
The dev server defaults to ``PORT=1999 PUBLIC_PATH=/authn`` (set in the ``dev``
|
|
106
|
+
script in ``package.json``) and is available at
|
|
107
|
+
`http://apps.local.openedx.io:1999/authn <http://apps.local.openedx.io:1999/authn>`_.
|
|
71
108
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
- ``https://example.com/tos``
|
|
109
|
+
Configuration used by the dev server is defined in ``site.config.dev.tsx`` at
|
|
110
|
+
the repo root.
|
|
75
111
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
- ``https://example.com/privacy``
|
|
112
|
+
Local Development Against ``frontend-base``
|
|
113
|
+
===========================================
|
|
79
114
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
- ``info@example.com``
|
|
115
|
+
To develop this app and a local checkout of ``frontend-base`` in tandem, use the
|
|
116
|
+
built-in npm workspace support:
|
|
83
117
|
|
|
84
|
-
|
|
85
|
-
- Enables support for configurable registration fields on the MFE. This flag must be enabled to show any required registration field besides the default fields (name, email, username, password).
|
|
86
|
-
- ``true`` | ``''`` (empty strings are falsy)
|
|
118
|
+
.. code-block:: sh
|
|
87
119
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
120
|
+
mkdir -p packages/frontend-base
|
|
121
|
+
sudo mount --bind /path/to/frontend-base packages/frontend-base
|
|
122
|
+
npm install
|
|
123
|
+
npm run dev:packages
|
|
124
|
+
|
|
125
|
+
Bind mounts are used instead of symlinks because Node resolves symlinks to their
|
|
126
|
+
real paths, which breaks hoisted dependency resolution. When you are done,
|
|
127
|
+
unmount with ``sudo umount packages/frontend-base``.
|
|
128
|
+
|
|
129
|
+
Configuration
|
|
130
|
+
=============
|
|
131
|
+
|
|
132
|
+
This app is no longer configured by build-time environment variables.
|
|
133
|
+
``getAppConfig`` resolves three sources, in order of increasing precedence: the
|
|
134
|
+
app's bundled defaults, the site's ``commonAppConfig``, and the app's ``config``.
|
|
135
|
+
The first is the app author's, at build time; the other two are the operator's,
|
|
136
|
+
the second applying to every app on the site and the third to this app alone. In
|
|
137
|
+
edx-platform they arrive as ``MFE_CONFIG`` and ``MFE_CONFIG_OVERRIDES['authn']``
|
|
138
|
+
respectively.
|
|
139
|
+
|
|
140
|
+
The full list of keys and their defaults is the ``config`` block in
|
|
141
|
+
``src/app.ts``. Most are self-explanatory support links, logo URLs and branding
|
|
142
|
+
strings. The ones worth describing:
|
|
143
|
+
|
|
144
|
+
.. list-table::
|
|
145
|
+
:widths: 30 50 20
|
|
146
|
+
:header-rows: 1
|
|
147
|
+
|
|
148
|
+
* - Name
|
|
149
|
+
- Description / Usage
|
|
150
|
+
- Example
|
|
151
|
+
|
|
152
|
+
* - ``ALLOW_PUBLIC_ACCOUNT_CREATION``
|
|
153
|
+
- Whether visitors may register themselves. When false, the registration
|
|
154
|
+
page and the links to it are hidden.
|
|
155
|
+
- ``true``
|
|
91
156
|
|
|
92
157
|
* - ``DISABLE_ENTERPRISE_LOGIN``
|
|
93
|
-
- Disables the enterprise login
|
|
94
|
-
- ``true``
|
|
158
|
+
- Disables the enterprise login flow.
|
|
159
|
+
- ``true``
|
|
95
160
|
|
|
96
|
-
* - ``
|
|
97
|
-
-
|
|
98
|
-
|
|
161
|
+
* - ``ENABLE_AUTO_GENERATED_USERNAME``
|
|
162
|
+
- Generates the username from the registration form rather than asking for
|
|
163
|
+
one.
|
|
164
|
+
- ``false``
|
|
99
165
|
|
|
100
|
-
* - ``
|
|
101
|
-
-
|
|
102
|
-
|
|
166
|
+
* - ``ENABLE_DYNAMIC_REGISTRATION_FIELDS``
|
|
167
|
+
- Enables configurable registration fields. Must be enabled to show any
|
|
168
|
+
registration field besides the defaults (name, email, username,
|
|
169
|
+
password).
|
|
170
|
+
- ``false``
|
|
103
171
|
|
|
104
172
|
* - ``ENABLE_IMAGE_LAYOUT``
|
|
105
|
-
-
|
|
106
|
-
|
|
173
|
+
- Allows images in the base container layout. See `Modifying base
|
|
174
|
+
container <docs/how_tos/modifying_base_container.rst>`_.
|
|
175
|
+
- ``false``
|
|
176
|
+
|
|
177
|
+
* - ``ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN``
|
|
178
|
+
- Enables progressive profiling. If enabled, users are redirected to a
|
|
179
|
+
second page where data for optional registration fields is collected.
|
|
180
|
+
- ``false``
|
|
181
|
+
|
|
182
|
+
* - ``POST_REGISTRATION_REDIRECT_URL``
|
|
183
|
+
- Where to send a user after registration, overriding the default route.
|
|
184
|
+
- ``''``
|
|
107
185
|
|
|
186
|
+
* - ``SHOW_REGISTRATION_LINKS``
|
|
187
|
+
- Whether to show links to the registration page from the other pages.
|
|
188
|
+
- ``true``
|
|
108
189
|
|
|
109
|
-
edX-specific
|
|
110
|
-
|
|
190
|
+
edX-specific Configuration
|
|
191
|
+
==========================
|
|
111
192
|
|
|
112
|
-
|
|
193
|
+
The following key enables an integration with a closed-source service private to
|
|
194
|
+
the edX organization, and might be unsupported in Open edX.
|
|
113
195
|
|
|
114
|
-
.. list-table::
|
|
196
|
+
.. list-table::
|
|
115
197
|
:widths: 30 50 20
|
|
116
198
|
:header-rows: 1
|
|
117
199
|
|
|
@@ -120,35 +202,81 @@ Furthermore, there are several edX-specific environment variables that enable in
|
|
|
120
202
|
- Example
|
|
121
203
|
|
|
122
204
|
* - ``MARKETING_EMAILS_OPT_IN``
|
|
123
|
-
- Enables
|
|
124
|
-
|
|
205
|
+
- Enables opting in to marketing emails, to capture user consent for
|
|
206
|
+
sending them.
|
|
207
|
+
- ``''``
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
*****
|
|
211
|
+
Slots
|
|
212
|
+
*****
|
|
213
|
+
|
|
214
|
+
This app offers slots for operators to customize its pages. See `src/slots/`_
|
|
215
|
+
for the current list and per-slot READMEs with usage examples.
|
|
216
|
+
|
|
217
|
+
.. _src/slots/: ./src/slots/
|
|
125
218
|
|
|
126
|
-
|
|
127
|
-
|
|
219
|
+
**********
|
|
220
|
+
Developing
|
|
221
|
+
**********
|
|
128
222
|
|
|
129
|
-
|
|
223
|
+
Project Structure
|
|
130
224
|
=================
|
|
131
225
|
|
|
132
|
-
|
|
133
|
-
|
|
226
|
+
The layout follows the standard `frontend-base app layout`_:
|
|
227
|
+
|
|
228
|
+
- ``src/app.ts`` - the app definition imported by ``site.config.*.tsx``.
|
|
229
|
+
- ``src/constants.ts`` - the app's ``appId`` and route role identifiers.
|
|
230
|
+
- ``src/index.ts`` - the package's public exports (this is a library).
|
|
231
|
+
- ``src/routes.jsx`` - the app's react-router routes.
|
|
232
|
+
- ``src/Main.tsx`` - the root component for the app's routes.
|
|
233
|
+
- ``src/provides.ts`` - what the app provides to the shell; here, the roles that
|
|
234
|
+
render its pages chromeless.
|
|
235
|
+
- ``src/slots/`` - the slots this app offers to consumers.
|
|
236
|
+
- ``src/style.scss`` and ``src/sass/`` - app-scoped runtime styles.
|
|
237
|
+
|
|
238
|
+
Everything else under ``src/`` is a feature directory, one per page or shared
|
|
239
|
+
concern, as described in `ADR 0002: feature based application organization
|
|
240
|
+
<docs/decisions/0002-feature-based-application-organization.rst>`_.
|
|
241
|
+
|
|
242
|
+
For more, see the `frontend-base migration how-to`_.
|
|
243
|
+
|
|
244
|
+
.. _frontend-base app layout: https://github.com/openedx/frontend-base/blob/main/docs/how_tos/migrate-frontend-app.md#src-file-structure
|
|
245
|
+
.. _frontend-base migration how-to: https://github.com/openedx/frontend-base/blob/main/docs/how_tos/migrate-frontend-app.md
|
|
246
|
+
|
|
247
|
+
Build Process Notes
|
|
248
|
+
===================
|
|
249
|
+
|
|
250
|
+
**Library build**
|
|
251
|
+
|
|
252
|
+
``npm run build`` compiles the library into ``dist/`` via ``tsc`` and
|
|
253
|
+
``tsc-alias``, and copies the SCSS across. This is what gets published and
|
|
254
|
+
consumed by sites.
|
|
255
|
+
|
|
256
|
+
**CI build**
|
|
257
|
+
|
|
258
|
+
``npm run build:ci`` runs ``openedx build`` against ``site.config.ci.tsx`` so
|
|
259
|
+
webpack traverses the full app graph. This catches issues, such as broken
|
|
260
|
+
lazy-loaded imports, that ``tsc`` and Jest would not surface.
|
|
134
261
|
|
|
135
|
-
|
|
262
|
+
Internationalization
|
|
263
|
+
====================
|
|
136
264
|
|
|
137
|
-
|
|
138
|
-
|
|
265
|
+
Please refer to the `frontend-base i18n howto`_ for documentation on
|
|
266
|
+
internationalization.
|
|
139
267
|
|
|
140
|
-
|
|
268
|
+
.. _frontend-base i18n howto: https://github.com/openedx/frontend-base/blob/main/docs/how_tos/i18n.rst
|
|
141
269
|
|
|
270
|
+
************
|
|
142
271
|
Getting Help
|
|
143
|
-
|
|
272
|
+
************
|
|
144
273
|
|
|
145
274
|
If you're having trouble, we have discussion forums at
|
|
146
275
|
https://discuss.openedx.org where you can connect with others in the community.
|
|
147
276
|
|
|
148
|
-
Our real-time conversations are on Slack. You can request a `Slack
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
channel`_.
|
|
277
|
+
Our real-time conversations are on Slack. You can request a `Slack invitation`_,
|
|
278
|
+
then join our `community Slack workspace`_. Because this is a frontend
|
|
279
|
+
repository, the best place to discuss it would be in the `#wg-frontend channel`_.
|
|
152
280
|
|
|
153
281
|
For anything non-trivial, the best path is to open an issue in this repository
|
|
154
282
|
with as many details about the issue you are facing as you can provide.
|
|
@@ -160,45 +288,71 @@ For more information about these options, see the `Getting Help`_ page.
|
|
|
160
288
|
.. _Slack invitation: https://openedx.org/slack
|
|
161
289
|
.. _community Slack workspace: https://openedx.slack.com/
|
|
162
290
|
.. _#wg-frontend channel: https://openedx.slack.com/archives/C04BM6YC7A6
|
|
163
|
-
.. _Getting Help: https://openedx.org/
|
|
291
|
+
.. _Getting Help: https://openedx.org/getting-help
|
|
164
292
|
|
|
293
|
+
*******
|
|
294
|
+
License
|
|
295
|
+
*******
|
|
296
|
+
|
|
297
|
+
The code in this repository is licensed under the AGPLv3 unless otherwise noted.
|
|
298
|
+
|
|
299
|
+
Please see `LICENSE <LICENSE>`_ for details.
|
|
300
|
+
|
|
301
|
+
************
|
|
302
|
+
Contributing
|
|
303
|
+
************
|
|
304
|
+
|
|
305
|
+
Contributions are very welcome. Please read `How To Contribute`_ for details.
|
|
306
|
+
|
|
307
|
+
.. _How To Contribute: https://openedx.org/r/how-to-contribute
|
|
308
|
+
|
|
309
|
+
This project is currently accepting all types of contributions, bug fixes and
|
|
310
|
+
security fixes.
|
|
311
|
+
|
|
312
|
+
The PR description template should be applied automatically if you open the pull
|
|
313
|
+
request from the GitHub interface; otherwise you can find it at
|
|
314
|
+
`pull_request_template.md <.github/pull_request_template.md>`_.
|
|
315
|
+
|
|
316
|
+
****************************
|
|
165
317
|
The Open edX Code of Conduct
|
|
166
|
-
|
|
167
|
-
All community members are expected to follow the `Open edX Code of Conduct <https://openedx.org/code-of-conduct/>`_.
|
|
318
|
+
****************************
|
|
168
319
|
|
|
320
|
+
All community members are expected to follow the `Open edX Code of Conduct`_.
|
|
321
|
+
|
|
322
|
+
.. _Open edX Code of Conduct: https://openedx.org/code-of-conduct/
|
|
323
|
+
|
|
324
|
+
******
|
|
169
325
|
People
|
|
170
|
-
|
|
326
|
+
******
|
|
327
|
+
|
|
171
328
|
The assigned maintainers for this component and other project details may be
|
|
172
|
-
found in `Backstage
|
|
329
|
+
found in `Backstage`_. Backstage pulls this data from the ``catalog-info.yaml``
|
|
173
330
|
file in this repo.
|
|
174
331
|
|
|
175
|
-
|
|
176
|
-
=========================
|
|
177
|
-
|
|
178
|
-
Please do not report security issues in public. Please email security@openedx.org.
|
|
179
|
-
|
|
180
|
-
Known Issues
|
|
181
|
-
============
|
|
332
|
+
.. _Backstage: https://backstage.openedx.org/catalog/default/component/frontend-app-authn
|
|
182
333
|
|
|
183
|
-
|
|
334
|
+
*************************
|
|
335
|
+
Reporting Security Issues
|
|
336
|
+
*************************
|
|
184
337
|
|
|
185
|
-
|
|
186
|
-
|
|
338
|
+
Please do not report security issues in public, and email security@openedx.org
|
|
339
|
+
instead.
|
|
187
340
|
|
|
188
|
-
|
|
189
|
-
|
|
341
|
+
.. |license-badge| image:: https://img.shields.io/github/license/openedx/frontend-app-authn.svg
|
|
342
|
+
:target: https://github.com/openedx/frontend-app-authn/blob/master/LICENSE
|
|
343
|
+
:alt: License
|
|
190
344
|
|
|
191
|
-
|
|
345
|
+
.. |status-badge| image:: https://img.shields.io/badge/Status-Maintained-brightgreen
|
|
346
|
+
:alt: Maintained
|
|
192
347
|
|
|
348
|
+
.. |ci-badge| image:: https://github.com/openedx/frontend-app-authn/actions/workflows/ci.yml/badge.svg
|
|
349
|
+
:target: https://github.com/openedx/frontend-app-authn/actions/workflows/ci.yml
|
|
350
|
+
:alt: Continuous Integration
|
|
193
351
|
|
|
194
|
-
|
|
352
|
+
.. |codecov-badge| image:: https://codecov.io/github/openedx/frontend-app-authn/coverage.svg?branch=master
|
|
353
|
+
:target: https://codecov.io/github/openedx/frontend-app-authn?branch=master
|
|
354
|
+
:alt: Codecov
|
|
195
355
|
|
|
196
|
-
.. |Build Status| image:: https://api.travis-ci.com/edx/frontend-app-authn.svg?branch=master
|
|
197
|
-
:target: https://travis-ci.com/edx/frontend-app-authn
|
|
198
|
-
.. |Codecov| image:: https://img.shields.io/codecov/c/github/edx/frontend-app-authn
|
|
199
|
-
:target: https://codecov.io/gh/edx/frontend-app-authn
|
|
200
|
-
.. |ci-badge| image:: https://github.com/openedx/edx-developer-docs/actions/workflows/ci.yml/badge.svg
|
|
201
|
-
:target: https://github.com/openedx/edx-developer-docs/actions/workflows/ci.yml
|
|
202
|
-
:alt: Continuous Integration
|
|
203
356
|
.. |semantic-release| image:: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
|
|
204
|
-
|
|
357
|
+
:target: https://github.com/semantic-release/semantic-release
|
|
358
|
+
:alt: semantic-release
|