-
Notifications
You must be signed in to change notification settings - Fork 214
AcquireTokenSilentAsync using Integrated authentication on Windows (Kerberos)
If you application runs on Windows (.NET Framework, Windows 8.1, UWP) on a machine which is either domain join, or AAD joined, and connected to the enterprise network (on premises, or through a VPN), it can benefit from another override of AcquireTokenSilent
leveraging Windows Integrated Authentication (WIA). This uses Kerberos.
The code is really simple. you need to instanciate a UserCredential
, and use the corresponding override of AcquireTokenAsync
:
result = await context.AcquireTokenAsync(resource, clientId, new UserCredential());
Note that, sometimes, policies set by the administrators on machines do not enable the logged-in user to be looked-up. In that case you should use the constructor of ``UserCredential` passing the upn of the user as a parameter, instead of the default, parameter less constructor.
result = await context.AcquireTokenAsync(resource, clientId,
new UserCredential("john@contoso.com"));
Note that this method is not available part of the
AuthenticationContext
class, but as anAcquireTokenAsync
extension method of theAuthenticationContextIntegratedAuthExtensions
class. This extension method takes as a parameter, in addition to the resource and clientId of the public client application an instance ofUserCredential
.
Sample | Description |
---|---|
active-directory-dotnet-native-headless | A windows desktop program that demonstrates non-interactive authentication to Azure AD using a username & password and optionaly windows integrated authentication. |
- Home
- Why use ADAL.NET?
- Register your app with AAD
- AuthenticationContext
- Acquiring Tokens
- Calling a protected API
- Acquiring a token interactively
- Acquiring tokens silently
- Using Device Code Flow
- Using Embedded Webview and System Browser in ADAL.NET and MSAL.NET
- With no user
- In the name of a user
- on behalf of (Service to service calls)
- by authorization code (Web Apps)
- Use async controller actions
- Exception types
- using Broker on iOS and Android
- Logging
- Token Cache serialization
- User management
- Using ADAL with a proxy
- Authentication context in multi-tenant scenarios
- Troubleshooting MFA in a WebApp or Web API
- Provide your own HttpClient
- iOS Keychain Access