connect RE to IdS

This commit is contained in:
Muhammad Azeez 2021-01-18 10:53:22 +03:00
parent 0265455823
commit 0f7550c362
2 changed files with 48 additions and 5 deletions

View File

@ -22,6 +22,7 @@ namespace OidcSamples.AuthorizationServer
};
private const string TrafficPoliceApi = "traffic-police-api";
private const string RealEstateApi = "real-estate-api";
public static IEnumerable<ApiScope> 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<ApiResource> ApiResources =>
@ -39,6 +44,13 @@ namespace OidcSamples.AuthorizationServer
// list of audiences when this scope is requested
Scopes = new List<string>{ 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<string>{ RealEstateApi },
},
};
public static IEnumerable<Client> 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,

View File

@ -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);