-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update authkit documentation & bump to version 0.2.0 (#1124)
Once this PR is closed, I will release appkit.
- Loading branch information
Showing
4 changed files
with
34 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -1,25 +1,24 @@ | ||
# `@opencast/tobira-authkit`: Helper for building your own Tobira auth handler | ||
|
||
This library enables you to build your own login handler that can be used with Tobira. | ||
Useful mostly for `auth.mode = "login-proxy"`. | ||
See [the documentation](https://elan-ev.github.io/tobira/setup/auth/login-proxy) for context and more information. | ||
Useful mostly for using the login callbacks or for intercepting login requests. | ||
See [the documentation](https://elan-ev.github.io/tobira/next/setup/auth/user/tobira-session) for context and more information. | ||
|
||
## API | ||
|
||
The API is described only very briefly here as all public functions and types are documented in code. | ||
The main entry point (and only non-type export) is `startServer`. | ||
There are two main entry points: `runLoginCallbackServer` (for `login-callback`) and `runLoginProxyServer` (for intercepting login requests). | ||
|
||
```typescript | ||
import { startServer, LoginCheck } from "@opencast/tobira-authkit"; | ||
import { runLoginCallbackServer, LoginCheck } from "@opencast/tobira-authkit"; | ||
|
||
startServer({ | ||
await runLoginCallbackServer({ | ||
check: myCheckFunction, | ||
// ... other options | ||
}); | ||
|
||
const myCheckFunction: LoginCheck = async ({ userid, password }) => { ... }; | ||
``` | ||
|
||
This starts an HTTP server that handles login requests by eventually calling the provided `check` function. | ||
This starts an HTTP server that handles login requests by calling the provided `check` function. | ||
Said function can either return `"forbidden"` or an object describing the user. | ||
In the latter case, this library will automatically send a `POST /~session` to Tobira. |
This file contains 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