public override int Run(string[] remainingArguments) { try { var configs = _uow.Settings.Get(QueryExpressionFactory.GetQueryExpression <tbl_Setting>() .Where(x => x.Deletable == true).ToLambda()); ConsoleHelper.StdOutSettings(configs); if (_configID == Guid.Empty) { Console.Out.Write(" *** Enter GUID of config to delete *** : "); _configID = Guid.Parse(StandardInput.GetInput()); } _uow.Settings.Delete(QueryExpressionFactory.GetQueryExpression <tbl_Setting>() .Where(x => x.Id == _configID && x.Deletable == true).ToLambda()); _uow.Commit(); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { if (_isEnabled.HasValue) { _role.IsEnabled = _isEnabled.Value; } if (_isDeletable.HasValue) { _role.IsDeletable = _isDeletable.Value; } var role = _service.Role_UpdateV1(_map.Map <RoleV1>(_role)) .Result; FormatOutput.Roles(_uow, new List <E_Role> { _map.Map <E_Role>(role) }, true); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { var expression = QueryExpressionFactory.GetQueryExpression <E_Role>(); if (!string.IsNullOrEmpty(_filter)) { expression = expression.Where(x => x.Name.Contains(_filter)); } _roles = _uow.Roles.Get(expression.ToLambda(), new List <Expression <Func <E_Role, object> > >() { x => x.AudienceRoles, x => x.RoleClaims, x => x.UserRoles, }) .TakeLast(_count); FormatOutput.Roles(_uow, _roles.OrderBy(x => x.Name)); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { var config = _uow.Settings.Get(QueryExpressionFactory.GetQueryExpression <tbl_Setting>() .Where(x => x.ConfigKey == _configType.ToString()).ToLambda()) .SingleOrDefault(); if (config == null) { throw new ConsoleHelpAsException($" *** Invalid config type '{_configType.ToString()}' ***"); } config.ConfigValue = _configValue; _uow.Settings.Update(config); _uow.Commit(); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { var license = _uow.Settings.Get(QueryExpressionFactory.GetQueryExpression <tbl_Setting>() .Where(x => x.ConfigKey == "RebexLicense").ToLambda()).OrderBy(x => x.Created) .Last(); Rebex.Licensing.Key = license.ConfigValue; AsymmetricKeyAlgorithm.Register(Curve25519.Create); AsymmetricKeyAlgorithm.Register(Ed25519.Create); AsymmetricKeyAlgorithm.Register(EllipticCurveAlgorithm.Create); if (string.IsNullOrEmpty(_secretCurrent)) { Console.Out.Write(" *** Enter current secret to encrypt passwords *** : "); _secretCurrent = StandardInput.GetHiddenInput(); } if (string.IsNullOrEmpty(_secretNew)) { Console.Out.Write(" *** Enter new secret to encrypt passwords *** : "); _secretNew = StandardInput.GetHiddenInput(); } else { _secretNew = AlphaNumeric.CreateString(32); Console.Out.WriteLine($" *** The new secret to encrypt passwords is *** : {_secretNew}"); } var keys = _uow.PrivateKeys.Get().ToList(); var creds = _uow.Credentials.Get().ToList(); Console.Out.WriteLine(); Console.Out.WriteLine(" *** Current private key pass ciphertexts *** "); ConsoleHelper.StdOutKeyPairSecrets(keys); Console.Out.WriteLine(); Console.Out.WriteLine(" *** Current credential password ciphertexts *** "); ConsoleHelper.StdOutCredentialSecrets(creds); keys = KeyHelper.EditPrivKeySecrets(_uow, keys, _secretCurrent, _secretNew).ToList(); creds = UserHelper.EditCredentialSecrets(_uow, creds, _secretCurrent, _secretNew).ToList(); Console.Out.WriteLine(); Console.Out.WriteLine(" *** New private key pass ciphertexts *** "); ConsoleHelper.StdOutKeyPairSecrets(keys); Console.Out.WriteLine(); Console.Out.WriteLine(" *** New credential password ciphertexts *** "); ConsoleHelper.StdOutCredentialSecrets(creds); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { if (!string.IsNullOrEmpty(_privKeyPass)) { Console.Out.Write(" *** Enter password for the private key *** : "); _privKeyPass = StandardInput.GetHiddenInput(); } else { _privKeyPass = AlphaNumeric.CreateString(32); Console.Out.WriteLine($" *** The password for the private key *** : {_privKeyPass}"); } var privKey = KeyHelper.CreatePrivKey(_conf, _uow, _keyAlgo, _privKeySize, _privKeyPass, SignatureHashAlgorithm.SHA256); var pubKey = _uow.PublicKeys.Get(QueryExpressionFactory.GetQueryExpression <tbl_PublicKey>() .Where(x => x.PrivateKeyId == privKey.Id).ToLambda()) .Single(); Console.Out.WriteLine($"{privKey.KeyValue}"); Console.Out.WriteLine($"{pubKey.KeyValue}"); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { var files = _user.tbl_UserFile.Count(); var folders = _user.tbl_UserFolder.Count(); if (files > 0) { throw new ConsoleHelpAsException($" *** The user can not be deleted. There are {files} files owned ***"); } if (folders > 0) { throw new ConsoleHelpAsException($" *** The user can not be deleted. There are {folders} folders owned ***"); } _uow.Users.Delete(_user); _uow.Commit(); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { if (_isEnabled.HasValue) { _login.IsEnabled = _isEnabled.Value; } if (_isDeletable.HasValue) { _login.IsDeletable = _isDeletable.Value; } var login = _service.Login_UpdateV1(_map.Map <LoginV1>(_login)) .Result; FormatOutput.Logins(_uow, new List <E_Login> { _map.Map <E_Login>(login) }, true); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { if (_isLockedOut.HasValue) { _user.IsLockedOut = _isLockedOut.Value; } if (_isDeletable.HasValue) { _user.IsDeletable = _isDeletable.Value; } var user = _service.User_UpdateV1(_map.Map <UserV1>(_user)) .Result; FormatOutput.Users(_uow, new List <E_User> { _map.Map <E_User>(user) }, true); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { var keys = _uow.PublicKeys.Get(QueryExpressionFactory.GetQueryExpression <tbl_PublicKey>() .Where(x => x.IdentityId == null && x.Deletable == false).ToLambda(), new List <Expression <Func <tbl_PublicKey, object> > >() { x => x.PrivateKey, }); if (_delete) { ConsoleHelper.StdOutKeyPairs(keys.OrderBy(x => x.Created)); Console.Out.Write(" *** Enter GUID of public key to delete *** : "); var input = Guid.Parse(StandardInput.GetInput()); var pubKey = _uow.PublicKeys.Get(QueryExpressionFactory.GetQueryExpression <tbl_PublicKey>() .Where(x => x.Id == input).ToLambda(), new List <Expression <Func <tbl_PublicKey, object> > >() { x => x.PrivateKey, }).SingleOrDefault(); if (pubKey != null) { _uow.PublicKeys.Delete(QueryExpressionFactory.GetQueryExpression <tbl_PublicKey>() .Where(x => x.Id == pubKey.Id).ToLambda()); _uow.PrivateKeys.Delete(QueryExpressionFactory.GetQueryExpression <tbl_PrivateKey>() .Where(x => x.Id == pubKey.PrivateKeyId).ToLambda()); _uow.Commit(); } } else if (_deleteAll) { ConsoleHelper.StdOutKeyPairs(keys.OrderBy(x => x.Created)); _uow.PublicKeys.Delete(QueryExpressionFactory.GetQueryExpression <tbl_PublicKey>() .Where(x => x.IdentityId == null && x.Deletable == false).ToLambda()); _uow.PrivateKeys.Delete(QueryExpressionFactory.GetQueryExpression <tbl_PrivateKey>() .Where(x => x.IdentityId == null && x.Deletable == false).ToLambda()); _uow.Commit(); } else { ConsoleHelper.StdOutKeyPairs(keys.OrderBy(x => x.Created)); } return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { FormatOutput.Logins(_uow, new List <E_Login> { _login }); Console.Out.WriteLine(); Console.Out.Write(" *** Enter 'yes' to delete login *** : "); var input = StandardInput.GetInput(); Console.Out.WriteLine(); if (input.ToLower() == "yes") { _ = _service.Login_DeleteV1(_login.Id) .Result; } return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { if (_isLockedOut.HasValue) { _audience.IsLockedOut = _isLockedOut.Value; } if (_isDeletable.HasValue) { _audience.IsDeletable = _isDeletable.Value; } var audience = _service.Audience_UpdateV1(_map.Map <AudienceV1>(_audience)) .Result; FormatOutput.Audiences(_uow, new List <E_Audience> { _map.Map <E_Audience>(audience) }, true); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { if (_user.tbl_UserMount != null) { Console.Out.WriteLine(" *** The user already has a mount ***"); Console.Out.WriteLine(); ConsoleHelper.StdOutUserMounts(new List <tbl_UserMount> { _user.tbl_UserMount }); return(StandardOutput.FondFarewell()); } var credentials = _uow.Credentials.Get(); ConsoleHelper.StdOutCredentials(credentials); Console.Out.WriteLine(); Console.Out.Write(" *** Enter GUID of credential to use for mount *** : "); var input = StandardInput.GetInput(); _user.tbl_UserMount.CredentialId = Guid.Parse(input); _uow.Users.Update(_user); _uow.Commit(); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { var license = _uow.Settings.Get(QueryExpressionFactory.GetQueryExpression <tbl_Setting>() .Where(x => x.ConfigKey == "RebexLicense").ToLambda()).OrderBy(x => x.Created) .Last(); Rebex.Licensing.Key = license.ConfigValue; AsymmetricKeyAlgorithm.Register(Curve25519.Create); AsymmetricKeyAlgorithm.Register(Ed25519.Create); AsymmetricKeyAlgorithm.Register(EllipticCurveAlgorithm.Create); try { if (string.IsNullOrEmpty(_privKeyPass)) { Console.Out.Write(" *** Enter password for the private key *** : "); _privKeyPass = StandardInput.GetHiddenInput(); } Console.Out.WriteLine(); Console.Out.WriteLine("Opened " + _path.FullName); KeyHelper.ImportPrivKey(_conf, _uow, _privKeyPass, SignatureHashAlgorithm.SHA256, new FileInfo(_path.FullName)); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { if (!string.IsNullOrEmpty(_pubKeyComment)) { Console.Out.Write(" *** Enter user@hostname or a comment for the public key *** : "); _pubKeyComment = StandardInput.GetInput(); } Console.Out.WriteLine("Opened " + _path.FullName); Console.Out.WriteLine(); if (_base64) { KeyHelper.ImportPubKeyBase64(_uow, _user, SignatureHashAlgorithm.SHA256, new FileInfo(_path.FullName)); } else { KeyHelper.ImportPubKey(_uow, _user, SignatureHashAlgorithm.SHA256, _pubKeyComment, new FileInfo(_path.FullName)); } return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { Console.Out.Write($" *** Enter password for user '{_user.UserName}' *** : "); var decryptedPass = StandardInput.GetHiddenInput(); Console.Out.WriteLine(); _ = _service.User_SetPasswordV1(_user.Id, new PasswordAddV1() { EntityId = _user.Id, NewPassword = decryptedPass, NewPasswordConfirm = decryptedPass, }).Result; var user = _service.User_GetV1(_user.Id.ToString()) .Result; FormatOutput.Users(_uow, new List <E_User> { _map.Map <E_User>(user) }); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { var env = new ContextService(InstanceContext.DeployedOrLocal); var uow = new UnitOfWork(_conf["Databases:IdentityEntities_EFCore"], env); var data = new DefaultDataFactory(uow); if (_create) { Console.WriteLine(); Console.WriteLine("\tPress key to create default data..."); Console.ReadKey(); data.CreateSettings(); data.CreateIssuers(); data.CreateAudiences(); data.CreateAudienceRoles(); data.CreateRoles(); data.CreateLogins(); data.CreateUsers(); data.CreateUserLogins(); data.CreateUserRoles(); Console.WriteLine("\tCompleted create default data..."); Console.WriteLine(); } else if (_destroy) { Console.WriteLine(); Console.WriteLine("\tPress key to destroy default data..."); Console.ReadKey(); data.Destroy(); Console.WriteLine("\tCompleted destroy default data..."); Console.WriteLine(); } else if (_destroyAll) { Console.WriteLine(); Console.WriteLine("\tPress key to destroy all data..."); Console.ReadKey(); data.Destroy(); Console.WriteLine("\tCompleted destroy all data..."); Console.WriteLine(); } return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { var credentials = _uow.Credentials.Get(); if (credentials.Where(x => x.Domain == _credDomain && x.UserName == _credLogin).Any()) { Console.Out.WriteLine(" *** The credential entered already exists ***"); Console.Out.WriteLine(); ConsoleHelper.StdOutCredentials(credentials); return(StandardOutput.FondFarewell()); } if (string.IsNullOrEmpty(_credPass)) { Console.Out.Write(" *** Enter credential password to use *** : "); _credPass = StandardInput.GetHiddenInput(); Console.Out.WriteLine(); } var secret = _conf["Databases:AuroraSecret"]; var cipherText = AES.EncryptString(_credPass, secret); var plainText = AES.DecryptString(cipherText, secret); if (_credPass != plainText) { throw new ArithmeticException(); } var credential = _uow.Credentials.Create( new tbl_Credential { Id = Guid.NewGuid(), Domain = _credDomain, UserName = _credLogin, Password = cipherText, Created = DateTime.Now, Enabled = true, Deletable = true, }); _uow.Commit(); Console.Out.WriteLine(); ConsoleHelper.StdOutCredentials(credentials); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { var admin = new AdminService(_conf); admin.Grant = new ResourceOwnerGrantV2(_conf); var users = admin.User_GetV1(new DataStateV1() { Sort = new List <IDataStateSort>() { new DataStateV1Sort() { Field = "userName", Dir = "asc" } }, Skip = 0, Take = 100, }).Result; foreach (var entry in users.Data) { Console.Out.WriteLine($" User '{entry.UserName}' with GUID '{entry.Id}'"); } Console.Out.WriteLine(); Console.Out.Write(" *** Enter GUID of (identity) user to use *** : "); var input = StandardInput.GetInput(); var user = _uow.Users.Create( new tbl_User { IdentityId = Guid.Parse(input), IdentityAlias = _userName, RequirePassword = true, RequirePublicKey = false, FileSystemType = _fileSystem.ToString(), Enabled = true, Deletable = false, Created = DateTime.Now, }); _uow.Commit(); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { _uow.Users.Update(_user); _uow.Commit(); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { UserV1 user = null; try { if (_human) { user = _service.User_CreateV1( new UserV1() { UserName = _userName, Email = _userName, FirstName = _firstName, LastName = _lastName, IsLockedOut = false, IsHumanBeing = true, IsDeletable = true, }).Result; } else { user = _service.User_CreateV1NoConfirm( new UserV1() { UserName = _userName, Email = _userName, FirstName = _firstName, LastName = _lastName, IsLockedOut = false, IsHumanBeing = false, IsDeletable = true, }).Result; } _ = _service.User_AddToLoginV1(user.Id, _login.Id) .Result; FormatOutput.Users(_uow, new List <E_User> { _map.Map <E_User>(user) }); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { FormatOutput.Users(_uow, new List <E_User> { _user }, true); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { ConsoleHelper.StdOutKeyPairs(_user.tbl_PublicKey.OrderBy(x => x.Created)); Console.Out.WriteLine(); ConsoleHelper.StdOutUserMounts(new List <tbl_UserMount> { _user.tbl_UserMount }); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { var credential = _uow.Credentials.Get(QueryExpressionFactory.GetQueryExpression <tbl_Credential>() .Where(x => x.Domain == _credDomain && x.UserName == _credLogin).ToLambda()) .SingleOrDefault(); if (credential == null) { throw new ConsoleHelpAsException($" *** Invalid credential '{_credDomain}\\{_credLogin}' ***"); } if (string.IsNullOrEmpty(_credPass)) { Console.Out.Write(" *** Enter credential password to use *** : "); _credPass = StandardInput.GetHiddenInput(); Console.Out.WriteLine(); } var secret = _conf["Databases:AuroraSecret"]; var cipherText = AES.EncryptString(_credPass, secret); var plainText = AES.DecryptString(cipherText, secret); if (_credPass != plainText) { throw new ArithmeticException(); } credential.Password = cipherText; credential.LastUpdated = DateTime.Now; _uow.Credentials.Update(credential); _uow.Commit(); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { var mount = _user.tbl_UserMount; ConsoleHelper.StdOutUserMounts(new List <tbl_UserMount> { mount }); _uow.UserMounts.Delete(mount); _uow.Commit(); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { var nets = _uow.Networks.Get(QueryExpressionFactory.GetQueryExpression <tbl_Network>() .Where(x => x.IdentityId == _user.IdentityId).ToLambda()); ConsoleHelper.StdOutNetworks(nets); if (_delete) { Console.Out.Write(" *** Enter GUID of network to delete *** : "); var input = Guid.Parse(StandardInput.GetInput()); var key = _uow.Networks.Get(QueryExpressionFactory.GetQueryExpression <tbl_Network>() .Where(x => x.IdentityId == _user.IdentityId && x.Id == input).ToLambda()) .SingleOrDefault(); if (key != null) { _uow.Networks.Delete(QueryExpressionFactory.GetQueryExpression <tbl_Network>() .Where(x => x.IdentityId == _user.IdentityId && x.Id == key.Id).ToLambda()); _uow.Commit(); } } else if (_deleteAll) { _uow.Networks.Delete(QueryExpressionFactory.GetQueryExpression <tbl_Network>() .Where(x => x.IdentityId == _user.IdentityId).ToLambda()); _uow.Commit(); } return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { var credentials = _uow.Credentials.Get(QueryExpressionFactory.GetQueryExpression <tbl_Credential>() .Where(x => x.Deletable == true).ToLambda()); ConsoleHelper.StdOutCredentials(credentials); if (_credID == Guid.Empty) { Console.Out.WriteLine(); Console.Out.Write(" *** Enter GUID of credential to delete *** : "); _credID = Guid.Parse(StandardInput.GetInput()); } var mounts = _uow.UserMounts.Get(QueryExpressionFactory.GetQueryExpression <tbl_UserMount>() .Where(x => x.CredentialId == _credID).ToLambda()); if (mounts.Any()) { Console.Out.WriteLine(); Console.Out.WriteLine(" *** The credential can not be deleted while in use ***"); Console.Out.WriteLine(); ConsoleHelper.StdOutUserMounts(mounts); return(StandardOutput.FondFarewell()); } _uow.Credentials.Delete(QueryExpressionFactory.GetQueryExpression <tbl_Credential>() .Where(x => x.Id == _credID && x.Deletable == true).ToLambda()); _uow.Commit(); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { _ = _service.Audience_AddToRoleV1(_audience.Id, _role.Id) .Result; var audience = _service.Audience_GetV1(_audience.Id.ToString()) .Result; FormatOutput.Audiences(_uow, new List <E_Audience> { _map.Map <E_Audience>(audience) }); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { _ = _service.User_RemoveFromRoleV1(_user.Id, _role.Id) .Result; var user = _service.User_GetV1(_user.Id.ToString()) .Result; FormatOutput.Users(_uow, new List <E_User> { _map.Map <E_User>(user) }); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }
public override int Run(string[] remainingArguments) { try { if (string.IsNullOrEmpty(_credPass)) { Console.Out.Write(" *** Enter credential password to use *** : "); _credPass = StandardInput.GetHiddenInput(); Console.Out.WriteLine(); } /* * Get the user token for the specified user, domain, and password using the unmanaged LogonUser method. * The local machine name can be used for the domain name to impersonate a user on this machine. */ var safeAccessTokenHandle = UserHelper.GetSafeAccessTokenHandle(_credDomain, _credLogin, _credPass); Console.Out.WriteLine("Beginning user is " + WindowsIdentity.GetCurrent().Name); Console.Out.WriteLine(); /* * to run as unimpersonated, pass 'SafeAccessTokenHandle.InvalidHandle' instead of variable 'safeAccessTokenHandle' */ WindowsIdentity.RunImpersonated(safeAccessTokenHandle, () => { Console.Out.WriteLine("Impersonated user is " + WindowsIdentity.GetCurrent().Name); Console.Out.WriteLine(); }); Console.Out.WriteLine("Ending user is " + WindowsIdentity.GetCurrent().Name); Console.Out.WriteLine(); return(StandardOutput.FondFarewell()); } catch (Exception ex) { return(StandardOutput.AngryFarewell(ex)); } }