public void DeRegisterAndUnenrollAccount(AuthenticationResult authenticationResult, bool withWipe = false) { try { _enrollmentManager.UnregisterAccountForMAM(_authenticationResult.UserInfo.UniqueId); } catch (Exception ex) { _loggingService.LogError(typeof(EnrollmentService), ex, ex.Message); } }
/// <summary> /// Signs the user out of the application and unenrolls from MAM. /// </summary> public void SignOut() { // Clear the app's token cache so the user will be prompted to sign in again. authContext.TokenCache.Clear(); string user = User; if (user != null) { // Remove the user's MAM policy from the app IMAMEnrollmentManager mgr = MAMComponents.Get <IMAMEnrollmentManager>(); mgr.UnregisterAccountForMAM(user); } Toast.MakeText(Android.App.Application.Context, Resource.String.auth_out_success, ToastLength.Short).Show(); }
/// <summary> /// Signs the user out of the application and unenrolls from MAM. /// </summary> /// <param name="listener"></param> public void SignOut(IAuthListener listener) { // Clear the app's token cache so the user will be prompted to sign in again. authContext.TokenCache.Clear(); string user = User; if (user != null) { // Remove the user's MAM policy from the app IMAMEnrollmentManager mgr = MAMComponents.Get <IMAMEnrollmentManager>(); mgr.UnregisterAccountForMAM(user); } isAuthenticated = false; listener.OnSignedOut(); }
/// <summary> /// Signs the user out of the application and unenrolls from MAM. /// </summary> public async void SignOut() { // Clear the app's token cache so the user will be prompted to sign in again. var currentAccounts = await PCA.GetAccountsAsync(); if (currentAccounts.Count() > 0) { await PCA.RemoveAsync(currentAccounts.FirstOrDefault()); } string user = User; if (user != null) { // Remove the user's MAM policy from the app IMAMEnrollmentManager mgr = MAMComponents.Get <IMAMEnrollmentManager>(); mgr.UnregisterAccountForMAM(user); } Toast.MakeText(Android.App.Application.Context, Resource.String.auth_out_success, ToastLength.Short).Show(); }
public async Task DeRegisterAndUnenrollAccountAsync(bool withWipe = false) { try { var token = await _authenticatorEndpointService.AcquireTokenSilentAsync(Endpoint); if (token != null) { InTuneLoggingService.Instance.AddMessage(new LoggingMessage { LogDate = DateTime.Now, Message = "Starting Deregister and Unenrollment", Module = SDKModule.Unenrollment }); _enrollmentManager.UnregisterAccountForMAM(token.UserInfo.UniqueId); } else { throw new Exception(Lib.Intune.Constants.Enrollment.ERRORNULL); } } catch (Exception ex) { _loggingService.LogError(typeof(EnrollmentService), ex, ex.Message); } }
/// <summary> /// Signs the user out of the application and unenrolls from MAM. /// </summary> /// <param name="listener"></param> public async void SignOut(IAuthListener listener) { // Clear the app's token cache so the user will be prompted to sign in again. var currentAccounts = await PCA.GetAccountsAsync(); if (currentAccounts.Count() > 0) { await PCA.RemoveAsync(currentAccounts.FirstOrDefault()); } string user = User; if (user != null) { // Remove the user's MAM policy from the app IMAMEnrollmentManager mgr = MAMComponents.Get <IMAMEnrollmentManager>(); mgr.UnregisterAccountForMAM(user); } isAuthenticated = false; listener.OnSignedOut(); }