Skip to content

Commit

Permalink
Jennyf/update desktop app (#735)
Browse files Browse the repository at this point in the history
* add forceRefresh checkbox to desktop app

* move to property
  • Loading branch information
jennyf19 authored Dec 18, 2018
1 parent ad037c3 commit 4e06932
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
13 changes: 13 additions & 0 deletions tests/devapps/DesktopTestApp/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions tests/devapps/DesktopTestApp/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ public partial class MainForm : Form
private readonly string[] _b2CScopes = { "https://msidlabb2c.onmicrosoft.com/msidlabb2capi/read" };
private const string B2CAuthority = "https://msidlabb2c.b2clogin.com/tfp/msidlabb2c.onmicrosoft.com/B2C_1_SISOPolicy/";
private const string B2CEditProfileAuthority = "https://msidlabb2c.b2clogin.com/tfp/msidlabb2c.onmicrosoft.com/B2C_1_ProfileEditPolicy/";


private bool IsForceRefreshEnabled => forceRefreshCheckBox.Checked;

public MainForm()
{
InitializeComponent();
Expand Down Expand Up @@ -266,7 +268,7 @@ private async void acquireTokenSilent_Click(object sender, EventArgs e)
try
{
AuthenticationResult authenticationResult =
await _publicClientHandler.AcquireTokenSilentAsync(SplitScopeString(scopes.Text)).ConfigureAwait(true);
await _publicClientHandler.AcquireTokenSilentAsync(SplitScopeString(scopes.Text), IsForceRefreshEnabled).ConfigureAwait(true);

SetResultPageInfo(authenticationResult);
}
Expand Down Expand Up @@ -579,7 +581,7 @@ private async void b2cSilentFlow_Click(object sender, EventArgs e)
try
{
AuthenticationResult authenticationResult =
await _publicClientHandler.AcquireTokenSilentAsync(_b2CScopes).ConfigureAwait(true);
await _publicClientHandler.AcquireTokenSilentAsync(_b2CScopes, IsForceRefreshEnabled).ConfigureAwait(true);

SetResultPageInfo(authenticationResult);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/devapps/DesktopTestApp/PublicClientHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ public async Task<AuthenticationResult> AcquireTokenInteractiveWithAuthorityAsyn
return result;
}

public async Task<AuthenticationResult> AcquireTokenSilentAsync(IEnumerable<string> scopes)
public async Task<AuthenticationResult> AcquireTokenSilentAsync(IEnumerable<string> scopes, bool forceRefresh)
{
return await PublicClientApplication.AcquireTokenSilentAsync(
scopes,
CurrentUser,
AuthorityOverride,
false).ConfigureAwait(false);
forceRefresh).ConfigureAwait(false);
}

public void CreateOrUpdatePublicClientApp(string interactiveAuthority, string applicationId)
Expand Down

0 comments on commit 4e06932

Please sign in to comment.