-
Notifications
You must be signed in to change notification settings - Fork 23
new provoder for Daemon type apps. #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
d45f189
8c8a164
0c9ddbb
b88d157
9a27511
3db43c1
51fa3a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,11 +18,11 @@ public class AdalDaemonAuthenticationProvider : AdalAuthenticationProviderBase | |
| { | ||
| private const int _retryCount = 3; | ||
| private const int _retrySleepDuration = 3000; | ||
| string _clientId; | ||
| string _clientKey; | ||
| protected string _clientId; | ||
| protected string _clientKey; | ||
|
|
||
| public IAuthenticationContextWrapper authContextWrapper; | ||
| ClientCredential clientCredential; | ||
| protected ClientCredential clientCredential; | ||
|
|
||
| protected override AuthenticateUserDelegate AuthenticateUser { get; set; } | ||
| protected override AuthenticateUserSilentlyDelegate AuthenticateUserSilently { get; set; } | ||
|
|
@@ -44,8 +44,8 @@ public AdalDaemonAuthenticationProvider( | |
| _clientKey = clientSecret; | ||
|
|
||
| string authority = String.Format(CultureInfo.InvariantCulture, "https://login.microsoftonline.com/{0}", tenant); | ||
| authContextWrapper = authenticationContextWrapper; | ||
| clientCredential = new ClientCredential(_clientId, _clientKey); | ||
| this.authContextWrapper = authenticationContextWrapper; | ||
| this.clientCredential = new ClientCredential(_clientId, _clientKey); | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only 1 extra line |
||
| this.AuthenticateUser = this.PromptUserForAuthenticationAsync; | ||
| this.AuthenticateUserSilently = this.SilentlyAuthenticateUserAsync; | ||
|
|
@@ -63,7 +63,7 @@ public async Task AuthenticateUserAsync(string serviceResourceId) | |
| retry = false; | ||
| try | ||
| { | ||
| result = await this.authContextWrapper.AcquireDaemonTokenSilentAsync( | ||
| result = await this.authContextWrapper.AcquireTokenSilentAsync( | ||
| serviceResourceId, | ||
| clientCredential); | ||
| } | ||
|
|
@@ -99,7 +99,7 @@ private async Task<IAuthenticationResult> SilentlyAuthenticateUserAsync( | |
| string userId, | ||
| bool throwOnError) | ||
| { | ||
| var result = await this.authContextWrapper.AcquireDaemonTokenSilentAsync( | ||
| var result = await this.authContextWrapper.AcquireTokenSilentAsync( | ||
| serviceResourceId, | ||
| clientCredential); | ||
| return result; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,7 +61,7 @@ public ITokenCache TokenCache | |
| /// <param name="resource">The resource to authenticate against.</param> | ||
| /// <param name="clientCredential">The client credential of the application.</param> | ||
| /// <returns>The <see cref="IAuthenticationResult"/>.</returns> | ||
| public async Task<IAuthenticationResult> AcquireDaemonTokenSilentAsync(string resource, ClientCredential clientCredential) | ||
| public async Task<IAuthenticationResult> AcquireTokenSilentAsync(string resource, ClientCredential clientCredential) | ||
|
||
| { | ||
| var result = await this.authenticationContext.AcquireTokenAsync(resource, clientCredential).ConfigureAwait(false); | ||
| return result == null ? null : new AuthenticationResultWrapper(result); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.clientCredential = new ClientCredential(this._clientId, this._clientKey);Please look for this everywhere in the file. Instance members and methods should always have
this.