diff --git a/CSharp/OidcSamples/OidcSamples.AuthorizationServer/Config.cs b/CSharp/OidcSamples/OidcSamples.AuthorizationServer/Config.cs index e3f180f..a464c82 100644 --- a/CSharp/OidcSamples/OidcSamples.AuthorizationServer/Config.cs +++ b/CSharp/OidcSamples/OidcSamples.AuthorizationServer/Config.cs @@ -22,6 +22,7 @@ namespace OidcSamples.AuthorizationServer }; private const string TrafficPoliceApi = "traffic-police-api"; + private const string RealEstateApi = "real-estate-api"; public static IEnumerable ApiScopes => new ApiScope[] @@ -29,6 +30,10 @@ namespace OidcSamples.AuthorizationServer new ApiScope( TrafficPoliceApi, "Traffic Police API scope"), + + new ApiScope( + RealEstateApi, + "Real Estate API scope"), }; public static IEnumerable ApiResources => @@ -39,6 +44,13 @@ namespace OidcSamples.AuthorizationServer // list of audiences when this scope is requested Scopes = new List{ TrafficPoliceApi }, }, + + new ApiResource(RealEstateApi, "Real Estate API") + { + // This will make sure that `real-estate-api` will be in the + // list of audiences when this scope is requested + Scopes = new List{ RealEstateApi }, + }, }; public static IEnumerable Clients => @@ -65,7 +77,7 @@ namespace OidcSamples.AuthorizationServer IdentityServerConstants.StandardScopes.Profile, IdentityServerConstants.StandardScopes.Email, IdentityServerConstants.StandardScopes.Address, - "traffic-police-api", + TrafficPoliceApi, }, RequirePkce = true, PostLogoutRedirectUris = @@ -76,6 +88,37 @@ namespace OidcSamples.AuthorizationServer RequireConsent = false, }, new Client + { + // IdentityTokenLifetime = + // AuthorizationCodeLifetime = + AccessTokenLifetime = 60 * 60 * 8, + AllowOfflineAccess = true, + UpdateAccessTokenClaimsOnRefresh = true, + ClientName = "Real Estate React App", + ClientId = "real-estate-react-app", + AllowedGrantTypes = GrantTypes.Code, + RequireClientSecret = false, + RedirectUris = + { + "http://localhost:4000/signin-oidc" + }, + AllowedScopes = + { + IdentityServerConstants.StandardScopes.OpenId, + IdentityServerConstants.StandardScopes.Profile, + IdentityServerConstants.StandardScopes.Email, + IdentityServerConstants.StandardScopes.Address, + RealEstateApi, + }, + RequirePkce = true, + PostLogoutRedirectUris = + { + "http://localhost:4000/signout-callback-oidc" + }, + + RequireConsent = false, + }, + new Client { AccessTokenLifetime = 60 * 60 * 8, AllowOfflineAccess = true, diff --git a/React/real-estate/src/services/userService.js b/React/real-estate/src/services/userService.js index c03c5a5..a3156a7 100644 --- a/React/real-estate/src/services/userService.js +++ b/React/real-estate/src/services/userService.js @@ -3,11 +3,11 @@ import { storeUserError, storeUser } from "../actions/authActions"; const config = { authority: "http://localhost:10000", - client_id: "traffic-police-react-app", - redirect_uri: "http://localhost:3000/signin-oidc", + client_id: "real-estate-react-app", + redirect_uri: "http://localhost:4000/signin-oidc", response_type: "code", - scope: "openid profile traffic-police-api", - post_logout_redirect_uri: "http://localhost:3000/signout-oidc", + scope: "openid profile real-estate-api", + post_logout_redirect_uri: "http://localhost:4000/signout-oidc", }; const userManager = new UserManager(config);