Skip to content

Commit 540f751

Browse files
committed
Create a mvctest client, check when is the environment variable UseLoadTest in MVC project to true
1 parent 5959887 commit 540f751

4 files changed

Lines changed: 40 additions & 6 deletions

File tree

src/Services/Identity/Identity.API/Configuration/Config.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,38 @@ public static IEnumerable<Client> GetClients(Dictionary<string,string> clientsUr
114114
"locations",
115115
"marketing"
116116
},
117+
},
118+
new Client
119+
{
120+
ClientId = "mvctest",
121+
ClientName = "MVC Client Test",
122+
ClientSecrets = new List<Secret>
123+
{
124+
new Secret("secret".Sha256())
125+
},
126+
ClientUri = $"{clientsUrl["Mvc"]}", // public uri of the client
127+
AllowedGrantTypes = GrantTypes.Hybrid,
128+
AllowAccessTokensViaBrowser = true,
129+
RequireConsent = false,
130+
AllowOfflineAccess = true,
131+
RedirectUris = new List<string>
132+
{
133+
$"{clientsUrl["Mvc"]}/signin-oidc"
134+
},
135+
PostLogoutRedirectUris = new List<string>
136+
{
137+
$"{clientsUrl["Mvc"]}/signout-callback-oidc"
138+
},
139+
AllowedScopes = new List<string>
140+
{
141+
IdentityServerConstants.StandardScopes.OpenId,
142+
IdentityServerConstants.StandardScopes.Profile,
143+
IdentityServerConstants.StandardScopes.OfflineAccess,
144+
"orders",
145+
"basket",
146+
"locations",
147+
"marketing"
148+
},
117149
}
118150
};
119151
}

src/Web/WebMVC/Startup.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,21 +112,22 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
112112

113113
var identityUrl = Configuration.GetValue<string>("IdentityUrl");
114114
var callBackUrl = Configuration.GetValue<string>("CallBackUrl");
115+
var useLoadTest = Configuration.GetValue<bool>("UseLoadTest");
115116
var log = loggerFactory.CreateLogger("identity");
116117

117118
var oidcOptions = new OpenIdConnectOptions
118119
{
119120
AuthenticationScheme = "oidc",
120121
SignInScheme = "Cookies",
121-
Authority = identityUrl.ToString(),
122-
PostLogoutRedirectUri = callBackUrl.ToString(),
123-
ClientId = "mvc",
122+
Authority = identityUrl,
123+
PostLogoutRedirectUri = callBackUrl,
124124
ClientSecret = "secret",
125-
ResponseType = "code id_token",
125+
ClientId = useLoadTest ? "mvctest" : "mvc",
126+
ResponseType = useLoadTest ? "code id_token token" : "code id_token",
126127
SaveTokens = true,
127128
GetClaimsFromUserInfoEndpoint = true,
128129
RequireHttpsMetadata = false,
129-
Scope = { "openid", "profile", "orders", "basket", "marketing" }
130+
Scope = { "openid", "profile", "orders", "basket", "marketing", "locations" }
130131
};
131132

132133
//Wait untill identity service is ready on compose.

src/Web/WebMVC/appsettings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"CallBackUrl": "http://localhost:5100/",
88
"IsClusterEnv": "False",
99
"UseResilientHttp": "True",
10+
"UseLoadTest": false,
1011
"Logging": {
1112
"IncludeScopes": false,
1213
"LogLevel": {

test/Services/LoadTest/Ordering.API/GetCardTypes.webtest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<WebTest Name="GetCardTypes" Id="bb2ad65f-7035-45c6-ab02-003376d478f4" Owner="" Priority="2147483647" Enabled="True" CssProjectStructure="" CssIteration="" Timeout="0" WorkItemIds="" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" Description="" CredentialUserName="" CredentialPassword="" PreAuthenticate="True" Proxy="default" StopOnError="False" RecordedResultFile="" ResultsLocale="">
2+
<WebTest Name="GetCardTypes" Id="5ad800ae-aa9a-4e40-844e-fab746fc966d" Owner="" Priority="2147483647" Enabled="True" CssProjectStructure="" CssIteration="" Timeout="0" WorkItemIds="" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" Description="" CredentialUserName="" CredentialPassword="" PreAuthenticate="True" Proxy="default" StopOnError="False" RecordedResultFile="" ResultsLocale="">
33
<Items>
44
<Request Method="GET" Guid="6010f193-941a-4a7b-98d4-45be7699a0dc" Version="1.1" Url="{{MvcWebServer}}/Account/SignIn" ThinkTime="0" Timeout="300" ParseDependentRequests="True" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="{{IdentityApiServer}}/account/login?returnUrl=%2Fconnect%2Fauthorize%2Flogin%3Fclient_id%3Dmvc%26redirect_uri%3D{{MvcWebServer}}%252Fsignin-oidc%26response_type%3Dcode%20id_token%20token%26scope%3Dopenid%20profile%20orders%20basket%20marketing%26response_mode%3Dform_post%26nonce%3D636343249853641220.YTUyNDUwYmUtMDUwNi00YzViLWI4ZjItZGJhZDMwNmM1YjNlMDNhYjZmOGItZTk5YS00ZGEzLTg1Y2UtMDE3YTFjNWFlNjEw%26state%3DCfDJ8OCCkEVDCp5PrdqHtEgvt_mxNTrlU_psyuqjm9lkemQgTEZ-k_LUyThb4S21qtGcud5ajY1BOwzMlk0uvC0p8CB9hqSKaaDpjvspLXMLHjjsZNqjG3bdvnGSHp08_go1orFXlRLeC-8dNSlLlzynWJp9uK_WC56gjcJAiqQErMBVub5lacO-ph04so9LMkZ5KSFxP0qPlkYidej2RfOYkNFxzZnLVTs5ZB_l7IU3EPgh8geWXtks_bnlnPCq9CMnWKuxlTY4_M44DCp0mMWmK_JqBfGSlnEt5d2iz2QThepUUgIg0XQxZsEPl0rsdpN0AXOXOc9bgTm-ApXmoAyBRC-dM_9k59MdxYAbipZGcwOc" ReportingName="" IgnoreHttpStatusCode="False">
55
<Headers>

0 commit comments

Comments
 (0)