Skip to content

Commit

Permalink
Use authorization code flow by adding client secret
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldgray committed Apr 20, 2022
1 parent 69a10ac commit 01b1819
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/AuthTest/AuthTest/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public IActionResult Mappings()
public static class RoleMappings
{
// Mapping of Auth0 'role' claim : DLCS role
public static Dictionary<string, IEnumerable<string>> Map = new()
public static readonly Dictionary<string, IEnumerable<string>> Map = new()
{
["Reader"] = new[] { "https://api.dlcs.io/customers/2/roles/clickthrough" },
["Staff"] = new[]
Expand Down
6 changes: 1 addition & 5 deletions src/AuthTest/AuthTest/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Auth0.AspNetCore.Authentication;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
Expand Down Expand Up @@ -35,6 +30,7 @@ public void ConfigureServices(IServiceCollection services)
.AddAuth0WebAppAuthentication(options => {
options.Domain = Configuration["Auth0:Domain"];
options.ClientId = Configuration["Auth0:ClientId"];
options.ClientSecret = Configuration["Auth0:ClientSecret"];
options.Scope = "openid profile email weco:patron_role";
});

Expand Down
3 changes: 2 additions & 1 deletion src/AuthTest/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ The following configuration values will need to be added to run the app:
```json
"Auth0": {
"Domain": "<my-domain>.eu.auth0.com",
"ClientId": "<client-id>"
"ClientId": "<client-id>",
"ClientSecret": "<client-secret>"
}
```

Expand Down

0 comments on commit 01b1819

Please sign in to comment.