Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gao-sun committed Jan 22, 2024
1 parent df974bf commit d510bad
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
38 changes: 35 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,14 @@ await webAssemblyHost

await webAssemblyHost.RunAsync();
```
5) Add a configuration file `wwwroot\appsettings.json`

5) Configure the client and identity server as described in the [Configuration](#configuration) section.

## Configuration

### Client

Add a configuration file `wwwroot\appsettings.json`

> [!NOTE]
> The Authorization Code Flow with Proof Key for Code Exchange (PKCE) is an authorization code flow to prevent CSRF and authorization code injection attacks and it is the only supported method. Use the configuration values as shown below.
Expand All @@ -87,7 +93,33 @@ await webAssemblyHost.RunAsync();
}
```

6) Use the following guides as reference for identity server configuration.
You can also configure the client when registering the service:

```csharp
builder.Services.AddBlorcOpenIdConnect(
options =>
{
options.ResponseType = "code";
// ...
});
```

See configuration sample code in the [demo app](src/Blorc.OpenIdConnect.DemoApp/Program.cs).

---

Some of the configuration options are described in the following table:

| Option | Description |
|--------|-------------|
| LoadUserInfo | Flag to control if additional identity data is loaded from the user info endpoint in order to populate the user's profile. |
| Resource | The `resource` parameter to send to the identity server. Useful when the identity server supports [RFC 8707](https://datatracker.ietf.org/doc/html/rfc8707). |
| ExtraQueryParams | Additional query string parameters to be including in the authorization request. |
| ExtraTokenParams | Additional parameters to be sent to the token endpoint. |

### Identity server

Use the following guides as reference for identity server configuration.

- [Authorization Code flow with PKCE (Keycloak)](https://www.appsdeveloperblog.com/pkce-verification-in-authorization-code-grant/)
- [PKCE Verification in Authorization Code Grant (Auth0)](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-proof-key-for-code-exchange-pkce)
Expand Down
2 changes: 1 addition & 1 deletion src/Blorc.OpenIdConnect.DemoApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
{
{ "foo", "bar" }
};
// The extra parameters that will be sent to the token request
// The extra parameters that will be sent to the token endpoint
options.ExtraTokenParams = new Dictionary<string, string>
{
{ "resource", "https://your-api.com" }
Expand Down

0 comments on commit d510bad

Please sign in to comment.