{"id":19175430,"url":"https://github.com/jzo001/forge.security.jwt.service","last_synced_at":"2025-10-14T19:11:13.849Z","repository":{"id":65368784,"uuid":"550846394","full_name":"JZO001/Forge.Security.Jwt.Service","owner":"JZO001","description":"Jwt Token based authentication / authorization service implementation","archived":false,"fork":false,"pushed_at":"2025-09-23T10:44:45.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-23T16:08:02.750Z","etag":null,"topics":["authentication","authorization","jwt","jwt-authentication","jwt-authorization","jwt-bearer-tokens","jwt-decode","jwt-server","jwt-token","sso","sso-authentication","sso-login","sso-server","sso-solution"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JZO001.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-10-13T12:27:08.000Z","updated_at":"2025-09-23T10:44:49.000Z","dependencies_parsed_at":"2024-11-09T10:23:34.577Z","dependency_job_id":"ba5faf98-b956-4971-aacf-e58f53dccbfa","html_url":"https://github.com/JZO001/Forge.Security.Jwt.Service","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JZO001/Forge.Security.Jwt.Service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JZO001%2FForge.Security.Jwt.Service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JZO001%2FForge.Security.Jwt.Service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JZO001%2FForge.Security.Jwt.Service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JZO001%2FForge.Security.Jwt.Service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JZO001","download_url":"https://codeload.github.com/JZO001/Forge.Security.Jwt.Service/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JZO001%2FForge.Security.Jwt.Service/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279020647,"owners_count":26086895,"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-10-14T02:00:06.444Z","response_time":60,"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":["authentication","authorization","jwt","jwt-authentication","jwt-authorization","jwt-bearer-tokens","jwt-decode","jwt-server","jwt-token","sso","sso-authentication","sso-login","sso-server","sso-solution"],"created_at":"2024-11-09T10:23:14.243Z","updated_at":"2025-10-14T19:11:13.833Z","avatar_url":"https://github.com/JZO001.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Forge.Security.Jwt.Service\nForge.Security.Jwt.Service is a server side library that provides JWT (JSON Web Token) based authentication services.\n\n\n## Installing\n\nTo install the package add the following line to you csproj file replacing x.x.x with the latest version number:\n\n```\n\u003cPackageReference Include=\"Forge.Security.Jwt.Service\" Version=\"x.x.x\" /\u003e\n```\n\nYou can also install via the .NET CLI with the following command:\n\n```\ndotnet add package Forge.Security.Jwt.Service\n```\n\nIf you're using Visual Studio you can also install via the built in NuGet package manager.\n\n\n## Usage\nTo use Forge.Security.Jwt.Service in service / server application check the example below.\n\n```c#\n\npublic async Task\u003cLoginResult\u003e Login(string username, string password, IEnumerable\u003cJwtKeyValuePair\u003e secondaryKeys)\n{\n\tawait _signInManager.SignOutAsync();\n\n\tLoginResult result = new LoginResult();\n\n\tbool isExist = false;\n\tbool isAccountDisabled = false;\n\tusing (DatabaseContext db = DatabaseContext.Create())\n\t{\n\t\tInititalizationAtStartup.IsUserAccountDisabled(db, username, out isExist, out isAccountDisabled);\n\t}\n\n\tif (isExist \u0026\u0026 !isAccountDisabled)\n\t{\n\t\tresult.LoginResponse = new JwtTokenResult();\n\n\t\tUser user = await _userManager.FindByNameAsync(username);\n\t\tSignInResult signInResult = await _signInManager.PasswordSignInAsync(user, password, false, false);\n\t\tresult.Succeeded = signInResult.Succeeded;\n\t\tresult.RequiresTwoFactor = signInResult.RequiresTwoFactor;\n\t\tresult.IsLockedOut = signInResult.IsLockedOut;\n\t\tresult.IsNotAllowed = signInResult.IsNotAllowed;\n\n\t\tvar claims = new[]\n\t\t{\n\t\t\tnew Claim(ClaimTypes.Name, username),\n\t\t\tnew Claim(ClaimTypes.Role, user.Role),\n\t\t\tnew Claim(ClaimTypes.NameIdentifier, user.Id),\n\t\t\tnew Claim(ClaimTypes.Surname, user.Surname),\n\t\t\tnew Claim(ClaimTypes.GivenName, user.Givenname),\n\t\t\tnew Claim(ClaimTypes.Email, user.Email),\n\t\t};\n\n\t\tJwtTokenResult jwtResult = _jwtAuthManager.GenerateTokens(username, claims, DateTime.UtcNow, secondaryKeys);\n\t\tresult.LoginResponse = jwtResult;\n\t}\n\n\treturn result;\n}\n\n```\n\nAbout the incoming parameters:\n- username and password are the standard user credentials\n- secondaryKeys is a set of additional keys or attributes which makes every users as unique as possible on the client side.\n\tIt is not mandatory to use it, but it is recommended to put additional info, like IP address and/or user-agent, etc.\n\nYou can find a full reference implementation in project \"Forge.Yoda\". Please feel free to check the project in my repositories.\nIn the solution, \"Forge.Yoda.Services.Authentication\" is what you are looking for.\n\n\nPlease also check the following projects in my repositories:\n- Forge.Yoda\n- Forge.Security.Jwt.Service\n- Forge.Security.Jwt.Service.Storage.SqlServer\n- Forge.Security.Jwt.Client\n- Forge.Security.Jwt.Client.Storage.Browser\n- Forge.Wasm.BrowserStorages\n- Forge.Wasm.BrowserStorages.NewtonSoft.Json\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjzo001%2Fforge.security.jwt.service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjzo001%2Fforge.security.jwt.service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjzo001%2Fforge.security.jwt.service/lists"}