-
Notifications
You must be signed in to change notification settings - Fork 9
Create "Harper Applications in Depth" Learn Guide #426
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
Show all changes
19 commits
Select commit
Hold shift + click to select a range
4f6d71c
start on draft of new guide section
Ethan-Arrowood 09201b7
oops, include changes to prev guide too
Ethan-Arrowood 331fe57
wip
Ethan-Arrowood 66fe4ba
wip
Ethan-Arrowood aff4acf
expand operations section, more resource focus
Ethan-Arrowood 4522811
its coming together!!
Ethan-Arrowood 732e231
remove ai links so we can preview
Ethan-Arrowood 96430c0
rename and simplify intro section
Ethan-Arrowood d578f09
finish learn guide drafts
Ethan-Arrowood 06aef60
forgot about basic-auth component
Ethan-Arrowood 712b603
fix up new learn guide
Ethan-Arrowood 6eab86d
format
Ethan-Arrowood 6fd09ac
delete coming soon page
Ethan-Arrowood 0163dbd
fix capitalization, add more reference links to text, and other small…
Ethan-Arrowood 9ae7260
Apply suggestions from code review
Ethan-Arrowood 5efae9b
Update learn/developers/harper-applications-in-depth.mdx
Ethan-Arrowood 31d0798
review fixes
Ethan-Arrowood fc84bc4
fix auth component due to prettier bug
Ethan-Arrowood 7c9ecc8
tweak restart
Ethan-Arrowood 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 was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,50 @@ | ||
| {/* Due to a bug in prettier formatting (https://github.com/prettier/prettier/issues/17700) we can't retain multi-line comments with empty lines. */} | ||
| {/* So instead, just store this edition of this component in a separate file until we get to update. */} | ||
| {/* Replace `basic-authentication.mdx` with this when we switch from using `atob()` here https://github.com/HarperFast/harper/blob/main/security/auth.ts#L181 potentially in v5 */} | ||
|
|
||
| <details> | ||
| <summary>Basic Authentication</summary> | ||
|
|
||
| The simplest authorization scheme is [Basic Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Authentication#basic_authentication_scheme) which transmits credentials as username/password pairs encoded using base64. Importantly, this scheme does not encrypt credentials. If used over an insecure connection, such as HTTP, they are susceptible to being compromised. Only ever use Basic Authentication over secured connections, such as HTTPS. Even then, its better to upgrade to an encryption based authentication scheme or certificates. Harper supports many different authentication mechanisms, and they will all be covered in later Learn guides. | ||
|
|
||
| Use the username and password values from the previous [Install and Connect](/learn/getting-started/install-and-connect-harper) guide to generate an authorization value. The important part is to combine the `username` and `password` using a colon `:` character, encode that using base64, and then append the result to `"Basic "`. | ||
|
|
||
| Here are some efficient methodologies: | ||
|
|
||
| {/* Maybe consider using Tabs here with labels like "Node.js <=v24" and ("Web" or "Winter" or "W/MCA" if defined that abbreviation earlier somehow?) */} | ||
|
|
||
| In Node.js v24 or earlier use the [`Buffer`](https://nodejs.org/docs/latest/api/buffer.html) API: | ||
|
|
||
| ```typescript | ||
| // Ensure you replace these with your installation's values | ||
| const username = 'HDB_ADMIN'; | ||
| const password = 'abc123!'; | ||
| const credentials = Buffer.from(`${username}:${password}`).toString('base64'); | ||
| const authorizationValue = `Basic ${credentials}`; | ||
| ``` | ||
|
|
||
| For Node.js v25 or later, most web browser consoles, and any WinterTC Minimum Common API compatible runtime use the [`Uint8Array.prototype.toBase64()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/toBase64) API: | ||
|
|
||
| ```typescript | ||
| // Ensure you replace these with your installation's values | ||
| const username = 'HDB_ADMIN'; | ||
| const password = 'abc123!'; | ||
| const credentials = new TextEncoder().encode(`${username}:${password}`).toBase64(); | ||
| const authorizationValue = `Basic ${credentials}`; | ||
| ``` | ||
|
|
||
| > Both of these options are preferred over [`btoa()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/btoa) do to its limitation to Latin-1 character set. | ||
| You would use the `authorizationValue` as the value for the `Authorization` header such as: | ||
|
|
||
| ```typescript | ||
| fetch('/', { | ||
| // ... | ||
| headers: { | ||
| Authorization: authorizationValue, | ||
| }, | ||
| // ... | ||
| }); | ||
| ``` | ||
|
|
||
| </details> |
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,26 @@ | ||
| <details> | ||
| <summary>Basic Authentication</summary> | ||
|
|
||
| The simplest authorization scheme is [Basic Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Authentication#basic_authentication_scheme) which transmits credentials as username/password pairs encoded using base64. Importantly, this scheme does not encrypt credentials. If used over an insecure connection, such as HTTP, they are susceptible to being compromised. Only ever use Basic Authentication over secured connections, such as HTTPS. Even then, its better to upgrade to an encryption based authentication scheme or certificates. Harper supports many different authentication mechanisms, and they will all be covered in later Learn guides. | ||
|
|
||
| Use the username and password values from the previous [Install and Connect](/learn/getting-started/install-and-connect-harper) guide to generate an authorization value. The important part is to combine the `username` and `password` using a colon `:` character, encode that using base64, and then append the result to `"Basic "`. | ||
|
|
||
| ```typescript | ||
| const username = 'HDB_ADMIN'; | ||
| const password = 'abc123!'; | ||
| const authorizationValue = `Basic ${btoa(`${username}:${password}`)}`; | ||
| ``` | ||
|
|
||
| You would use the `authorizationValue` as the value for the `Authorization` header such as: | ||
|
|
||
| ```typescript | ||
| fetch('/', { | ||
| // ... | ||
| headers: { | ||
| Authorization: authorizationValue, | ||
| }, | ||
| // ... | ||
| }); | ||
| ``` | ||
|
|
||
| </details> |
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,16 @@ | ||
| ``` | ||
| ┏━━━━━━━━━━━━━━━━━━┓ | ||
| ┃ Applications ┃ | ||
| ┠──────────────────┨ | ||
| ┃ Plugins ┃ | ||
| ┃ - rest ┃ | ||
| ┃ - graphqlSchema ┃ | ||
| ┃ - ... ┃ | ||
| ┠──────────────────┨ | ||
| ┃ Core Services: ┃ | ||
| ┃ - database ┃ | ||
| ┃ - networking ┃ | ||
| ┃ - component ┃ | ||
| ┃ management ┃ | ||
| ┗━━━━━━━━━━━━━━━━━━┛ | ||
| ``` |
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.
Uh oh!
There was an error while loading. Please reload this page.