- LogoutFilter The LogoutFilter class is a filter in an ASP.NET Core application that intercepts requests to the logout endpoint and invalidates the user's token. This filter is useful for implementing logout functionality by invalidating the user's token upon logout. - TokenBlackListMiddleware The TokenBlackListMiddleware class is responsible for checking if a token is blacklisted and preventing access if it is. It also provides a method to blacklist tokens for a specified duration. This middleware is useful for implementing logout functionality by blacklisting tokens upon logout.
$ dotnet add package MasterNeverDown.CommandMasterNeverDown Command is a C# library designed to execute command-line and PowerShell commands programmatically. It provides synchronous methods to run commands and handle their output, including error handling and timeout management.
To install the library, clone the repository and include the CmdHelper.cs file in your project.
git clone https://github.com/yourusername/MasterNeverDown.Command.git
dotnet add package MasterNeverDown.Command
using MasterNeverDown.Command;
// 后续可以使用该包中的类型和方法
...
var result = CmdHelper.ExecuteCommand("echo Hello World");
if (result.Item1)
{
Console.WriteLine("Output: " + result.Item2);
}
else
{
Console.WriteLine("Error: " + result.Item2);
}
var result = CmdHelper.ExecutePowershell("Get-Process", ("Name", "cmd"));
if (result.Item1)
{
Console.WriteLine("Output: " + result.Item2);
}
else
{
Console.WriteLine("Error: " + result.Item2);
}
The project includes a set of unit tests to verify the functionality of the command execution methods. The tests cover various scenarios, including valid commands, invalid commands, and edge cases. To run the tests, use the following command:
dotnet test
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to customize this `README.md` to better fit your project's specifics and requirements.