117 lines
4.4 KiB
Plaintext
117 lines
4.4 KiB
Plaintext
@model MemberCenter.TestSite.Models.TestDashboardViewModel
|
|
@{
|
|
ViewData["Title"] = "Member Center Test Site";
|
|
string ShortToken(string? token) => string.IsNullOrWhiteSpace(token)
|
|
? "not set"
|
|
: $"{token[..Math.Min(18, token.Length)]}...";
|
|
}
|
|
|
|
<div class="test-hero">
|
|
<div>
|
|
<p class="eyebrow">Member Center Integration Test</p>
|
|
<h1>API / Redirect Login Happy Paths</h1>
|
|
<p>This test site stores tokens in its own ASP.NET session and runs the first 10 happy-path checks against Member Center.</p>
|
|
</div>
|
|
<form method="post" asp-action="ClearTokens">
|
|
<button type="submit" class="danger">Clear Session Tokens</button>
|
|
</form>
|
|
</div>
|
|
|
|
<section class="grid">
|
|
<article class="card">
|
|
<h2>Current Settings</h2>
|
|
<dl>
|
|
<dt>API Base URL</dt>
|
|
<dd>@Model.Options.ApiBaseUrl</dd>
|
|
<dt>web_login Client ID</dt>
|
|
<dd>@(string.IsNullOrWhiteSpace(Model.Options.WebLoginClientId) ? "not configured" : Model.Options.WebLoginClientId)</dd>
|
|
<dt>Service Client ID</dt>
|
|
<dd>@(string.IsNullOrWhiteSpace(Model.Options.ServiceClientId) ? "not configured" : Model.Options.ServiceClientId)</dd>
|
|
<dt>User token</dt>
|
|
<dd>@ShortToken(Model.UserAccessToken)</dd>
|
|
<dt>Service token</dt>
|
|
<dd>@ShortToken(Model.ServiceAccessToken)</dd>
|
|
</dl>
|
|
</article>
|
|
|
|
<article class="card">
|
|
<h2>1. Redirect Login</h2>
|
|
<p>Uses <code>usage=web_login</code>, Authorization Code + PKCE, and this site's <code>/auth/callback</code>.</p>
|
|
<form method="post" asp-action="RedirectLogin">
|
|
<button type="submit">Start Redirect Login</button>
|
|
</form>
|
|
</article>
|
|
|
|
<article class="card">
|
|
<h2>2. API Login</h2>
|
|
<form method="post" asp-action="ApiLogin">
|
|
<label>Email</label>
|
|
<input name="email" type="email" autocomplete="username" required />
|
|
<label>Password</label>
|
|
<input name="password" type="password" autocomplete="current-password" required />
|
|
<button type="submit">Get User Token</button>
|
|
</form>
|
|
</article>
|
|
|
|
<article class="card">
|
|
<h2>Service Token</h2>
|
|
<p>Required for checks 9 and 10.</p>
|
|
<form method="post" asp-action="ServiceToken">
|
|
<label>Client ID</label>
|
|
<input name="clientId" value="@Model.Options.ServiceClientId" />
|
|
<label>Client Secret</label>
|
|
<input name="clientSecret" type="password" value="@Model.Options.ServiceClientSecret" />
|
|
<label>Scopes</label>
|
|
<input name="scopes" value="@Model.Options.ServiceScopes" />
|
|
<button type="submit">Get Service Token</button>
|
|
</form>
|
|
</article>
|
|
</section>
|
|
|
|
<section class="card">
|
|
<h2>User Token Happy Paths</h2>
|
|
<div class="actions">
|
|
<form method="post" asp-action="UserProfileGet">
|
|
<button type="submit">3. GET /user/profile</button>
|
|
</form>
|
|
<form method="post" asp-action="UserProfilePost">
|
|
<button type="submit">4. POST /user/profile</button>
|
|
</form>
|
|
<form method="post" asp-action="UserAddressesGet">
|
|
<button type="submit">5. GET /user/addresses</button>
|
|
</form>
|
|
<form method="post" asp-action="UserAddressesPost">
|
|
<button type="submit">6. POST /user/addresses</button>
|
|
</form>
|
|
<form method="post" asp-action="UserSubscriptionsGet">
|
|
<button type="submit">7. GET /user/subscriptions</button>
|
|
</form>
|
|
</div>
|
|
<form method="post" asp-action="UserSubscriptionsUnsubscribe" class="inline-form">
|
|
<label>Subscription ID</label>
|
|
<input name="subscriptionId" placeholder="00000000-0000-0000-0000-000000000000" />
|
|
<button type="submit">8. POST /user/subscriptions/{id}/unsubscribe</button>
|
|
</form>
|
|
</section>
|
|
|
|
<section class="card">
|
|
<h2>Service Token Happy Paths</h2>
|
|
<p>Use a service token with at least <code>profile:basic.read</code> and <code>profile:addresses.read</code>.</p>
|
|
<form method="post" asp-action="ServiceProfileByEmail" class="inline-form">
|
|
<label>Email</label>
|
|
<input name="email" type="email" required />
|
|
<button type="submit">9. GET /user/profile/by-email</button>
|
|
</form>
|
|
<form method="post" asp-action="ServiceAddressesByEmail" class="inline-form">
|
|
<label>Email</label>
|
|
<input name="email" type="email" required />
|
|
<button type="submit">10. GET /user/addresses/by-email</button>
|
|
</form>
|
|
</section>
|
|
|
|
<section class="card response-card">
|
|
<h2>Last Response</h2>
|
|
<h3>@(Model.LastResponseTitle ?? "No request yet")</h3>
|
|
<pre>@(Model.LastResponseBody ?? "Run a happy-path action to see the response here.")</pre>
|
|
</section>
|