Skip to content

Commit

Permalink
Update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jonashendrickx committed Aug 1, 2024
1 parent 11a68d0 commit d2077a5
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 16 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Examples:

- [Passwordless.Example](examples/Passwordless.Example) — basic Passwordless.dev integration inside an ASP.NET app
- [Passwordless.AspNetIdentity.Example](examples/Passwordless.AspNetIdentity.Example) — Passwordless.dev integration using ASP.NET Identity.
- [Passwordless.MultiTenancy.Example](examples/Passwordless.AspNetIdentity.Example) — Passwordless.dev integration for multi-tenant applications.

## Usage

Expand Down
50 changes: 50 additions & 0 deletions examples/Passwordless.MultiTenancy.Example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Requirements:
- .NET 8.0 or later
- Passwordless.dev Pro or Enterprise

# Getting started
This example demonstrates how to use the Passwordless library in a multi-tenant environment. Where the subdomain is used
to identify the tenant. For example:

- `republicans.passwordless.local`
- `democrats.passwordless.local`

We can achieve this by bootstrapping the Passwordless SDK ourselves in `Program.cs` and providing the necessary
configuration.

For a tenant `democrats` or `republicants` respectively. You would find the configuration then in your appsettings.json
file. Similarly, you can use a database or any other configuration source.

```json
{
"Passwordless": {
"Tenants": {
"republicans": {
"ApiSecret": "republicans:secret:00000000000000000000000000000000"
},
"democrats": {
"ApiSecret": "democrats:secret:00000000000000000000000000000000"
}
}
}
}
```

1. Create entries in the hosts file:

127.0.0.1 republicans.passwordless.local
127.0.0.1 democrats.passwordless.local

These are the tenants of your own backend as an example named 'republicans' and 'democrats'

2. Modify any tenants and their related `ApiSecret` setting in the `appsettings.json` file.

3. Run the sample locally with .NET 8, debug if you have to step through. And visit:

- http://republicans.passwordless.local/swagger/index.html
- http://democrats.passwordless.local/swagger/index.html

4. Call the 'Users' endpoint from Swagger to test using your own API secrets obtained.

You can refer to the `Passwordless.Example` project how to create your own complete backend with the Passwordless
library, as this example is a stripped-down version of it to demonstrate multi-tenancy in a simple way.
15 changes: 0 additions & 15 deletions examples/Passwordless.MultiTenancy.Example/readme.md

This file was deleted.

2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.303",
"version": "8.0.204",
"rollForward": "latestMinor"
}
}

0 comments on commit d2077a5

Please sign in to comment.