From 5e7a20bcec3fc11884e680621b7037172920f3a1 Mon Sep 17 00:00:00 2001 From: RolandGuijt Date: Mon, 15 Jul 2024 22:45:48 +0200 Subject: [PATCH] BFF now requests offline_access, useEndpoints removed (#202) * Request offline_access * Remove limited access token lifetime --------- Co-authored-by: Roland Guijt --- .../src/IdentityServer/Config.cs | 1 + .../src/JavaScriptClient/Program.cs | 20 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/IdentityServer/v7/Quickstarts/6_JS_with_backend/src/IdentityServer/Config.cs b/IdentityServer/v7/Quickstarts/6_JS_with_backend/src/IdentityServer/Config.cs index 4be2656d..17127997 100755 --- a/IdentityServer/v7/Quickstarts/6_JS_with_backend/src/IdentityServer/Config.cs +++ b/IdentityServer/v7/Quickstarts/6_JS_with_backend/src/IdentityServer/Config.cs @@ -88,6 +88,7 @@ public static class Config // where to redirect to after logout PostLogoutRedirectUris = { "https://localhost:5003/signout-callback-oidc" }, + AllowOfflineAccess = true, AllowedScopes = new List { diff --git a/IdentityServer/v7/Quickstarts/6_JS_with_backend/src/JavaScriptClient/Program.cs b/IdentityServer/v7/Quickstarts/6_JS_with_backend/src/JavaScriptClient/Program.cs index 6eebc805..656868cb 100644 --- a/IdentityServer/v7/Quickstarts/6_JS_with_backend/src/JavaScriptClient/Program.cs +++ b/IdentityServer/v7/Quickstarts/6_JS_with_backend/src/JavaScriptClient/Program.cs @@ -27,6 +27,7 @@ options.ClientSecret = "secret"; options.ResponseType = "code"; options.Scope.Add("api1"); + options.Scope.Add("offline_access"); options.SaveTokens = true; options.GetClaimsFromUserInfoEndpoint = true; }); @@ -47,20 +48,17 @@ app.UseAuthorization(); -app.UseEndpoints(endpoints => -{ - endpoints.MapBffManagementEndpoints(); +app.MapBffManagementEndpoints(); - // Uncomment this for Controller support - // endpoints.MapControllers() - // .AsBffApiEndpoint(); +// Uncomment this for Controller support +// app.MapControllers() +// .AsBffApiEndpoint(); - endpoints.MapGet("/local/identity", LocalIdentityHandler) - .AsBffApiEndpoint(); +app.MapGet("/local/identity", LocalIdentityHandler) + .AsBffApiEndpoint(); - endpoints.MapRemoteBffApiEndpoint("/remote", "https://localhost:6001") - .RequireAccessToken(Duende.Bff.TokenType.User); -}); +app.MapRemoteBffApiEndpoint("/remote", "https://localhost:6001") + .RequireAccessToken(Duende.Bff.TokenType.User); app.Run();