{"id":30220935,"url":"https://github.com/vitormoschetta/vithor.auth","last_synced_at":"2026-05-16T01:33:55.744Z","repository":{"id":104184287,"uuid":"579602004","full_name":"vitormoschetta/ViThor.Auth","owner":"vitormoschetta","description":"A small package that adds Authentication, Authorization, User Email sending and validation layer to your dotnet application.","archived":false,"fork":false,"pushed_at":"2022-12-27T20:39:07.000Z","size":42,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-14T09:42:36.378Z","etag":null,"topics":["aspnet-core","authentication","authorization","dotnet","dotnet-core","email","email-sender","email-validation","jwt","jwt-token","openid","openid-connect","refresh-token","token"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vitormoschetta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-18T08:40:16.000Z","updated_at":"2024-06-21T03:12:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"498b54f2-4240-422c-90be-52952fe26395","html_url":"https://github.com/vitormoschetta/ViThor.Auth","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vitormoschetta/ViThor.Auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitormoschetta%2FViThor.Auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitormoschetta%2FViThor.Auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitormoschetta%2FViThor.Auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitormoschetta%2FViThor.Auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vitormoschetta","download_url":"https://codeload.github.com/vitormoschetta/ViThor.Auth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitormoschetta%2FViThor.Auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272940980,"owners_count":25019016,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aspnet-core","authentication","authorization","dotnet","dotnet-core","email","email-sender","email-validation","jwt","jwt-token","openid","openid-connect","refresh-token","token"],"created_at":"2025-08-14T09:25:30.152Z","updated_at":"2026-05-16T01:33:55.708Z","avatar_url":"https://github.com/vitormoschetta.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ViThor Auth\n\nA small package that adds Authentication and Authorization layer, based on Json Web Token (JWT), in your dotnet application.\n\nReady-made endpoints are available for:\n- User Registration\n- Login (get token)\n- Token Validation\n- Refresh Token\n\nAn email submission and validation service is also now available in this library.\n\n\n## Installation\n\nInstall the package from NuGet:\n\n```bash\ndotnet add package ViThor.Auth\n```\n\n\n## Usage\n\n### Authentication\n\nIt is necessary to create a class that inherits from UserBase:\n\n```csharp\npublic class User : UserBase\n{    \n}\n```\n\nNext, you need to create a class that implements the IUserService interface.\nYou can get a sample implementation in `Samples/Vithor.Auth.Sample/Serives/UserService.cs`.\n\nAdd the class that implements the IUserService to the `Program.cs` dependency injection service:\n    \n```csharp\nbuilder.Services.AddScoped\u003cIUserService\u003cUser\u003e, UserService\u003e();\n```\n\nThe remaining settings and services are built by running:\n\n```csharp\nbuilder.BuildViThorSettings();\n```\n\nThe parameterization of these services is done in appsettings:\n\n```json\n{\n    \"JwtConfig\": {\n        \"Secret\": \"This is my custom Secret key for authnetication\",\n        \"Issuer\": \"http://localhost:5000\",\n        \"Audience\": \"http://localhost:5000\",\n        \"ExpirationType\": \"Minutes\",\n        \"Expiration\": 1,\n        \"ValidateIssuerSigningKey\": true,\n        \"ValidateLifetime\": true,\n        \"ValidateIssuer\": false,\n        \"ValidateAudience\": false,\n        \"RequireHttpsMetadata\": false,\n        \"SaveToken\": false\n    }\n}\n```\n\nAdd AuthController to the API:\n\n```csharp\npublic class AuthController : AuthControllerBase\u003cUser\u003e\n{\n    public AuthController(IJwtService jwtServices, IEmailService emailService, IUserService\u003cUser\u003e userService, IOptions\u003cViThorAuthSettings\u003e appSettings) : base(jwtServices, emailService, userService, appSettings)\n    {\n    }\n}\n```\n\n### E-mail\n\nE-mail configuration is not required. That is, only if you are going to use the email sending service to validate the user registration, add the parameters below in appsettings:\n\n```json\n{\n    \"BaseAddress\": \"http://localhost:5000\",\n    \"SmtpConfig\": {\n        \"Enabled\": true,\n        \"Host\": \"smtp.gmail.com\",\n        \"Port\": 587,\n        \"UserName\": \"user@gmail.com\",\n        \"Password\": \"password-here\",\n        \"From\": \"user@gmail.com\"\n    }\n}\n```\n\n\n## Sample\n\nThe sample project is available in the repository. It is a simple dotnet web api project that uses the ViThor.Auth package.\n\n\n### Running the sample\n\nRun the following command to run the sample API:\n\n```bash\ndotnet run --project ./Samples/Vithor.Auth.Sample/ViThor.Auth.Sample.csproj\n```\n\n### Testing the sample\n\n#### Swagger\n\nThe sample project has Swagger configured. To access it, run the API and access the following URL:\n\n```bash\nhttp://localhost:5000/swagger/index.html\n```\n\n#### Postman\n\nThe example project has a Postman collection that can be used to test endpoints. To use it, import the collections from the `Postman` folder into Postman and run the requests.\n\n\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitormoschetta%2Fvithor.auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvitormoschetta%2Fvithor.auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitormoschetta%2Fvithor.auth/lists"}