{"id":13825181,"url":"https://github.com/HangfireIO/Hangfire.Dashboard.Authorization","last_synced_at":"2025-07-08T21:31:25.749Z","repository":{"id":18222057,"uuid":"21362134","full_name":"HangfireIO/Hangfire.Dashboard.Authorization","owner":"HangfireIO","description":"Some authorization filters for Hangfire's Dashboard","archived":false,"fork":false,"pushed_at":"2024-07-08T02:32:19.000Z","size":7194,"stargazers_count":150,"open_issues_count":0,"forks_count":69,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-06-25T04:22:41.546Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":false,"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/HangfireIO.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":"2014-06-30T18:51:28.000Z","updated_at":"2025-06-19T00:51:14.000Z","dependencies_parsed_at":"2024-12-20T04:03:50.382Z","dependency_job_id":"4707763d-3af2-4065-b519-0f0760b52d1b","html_url":"https://github.com/HangfireIO/Hangfire.Dashboard.Authorization","commit_stats":{"total_commits":51,"total_committers":9,"mean_commits":5.666666666666667,"dds":"0.21568627450980393","last_synced_commit":"1484dac0056268fc7dbd1b74cf5d5cb7391f930a"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/HangfireIO/Hangfire.Dashboard.Authorization","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HangfireIO%2FHangfire.Dashboard.Authorization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HangfireIO%2FHangfire.Dashboard.Authorization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HangfireIO%2FHangfire.Dashboard.Authorization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HangfireIO%2FHangfire.Dashboard.Authorization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HangfireIO","download_url":"https://codeload.github.com/HangfireIO/Hangfire.Dashboard.Authorization/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HangfireIO%2FHangfire.Dashboard.Authorization/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264352695,"owners_count":23594951,"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","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":[],"created_at":"2024-08-04T09:01:16.046Z","updated_at":"2025-07-08T21:31:23.910Z","avatar_url":"https://github.com/HangfireIO.png","language":"C#","funding_links":[],"categories":["C# #"],"sub_categories":[],"readme":"Hangfire.Dashboard.Authorization\n================================\n\nSome authorization filters for Hangfire's Dashboard for .NET Framework-based ASP.NET Applications.\n\nInstallation\n-------------\n\nThis library is available as a NuGet Package:\n\n```powershell\nInstall-Package Hangfire.Dashboard.Authorization\n```\n\nUsage\n------\n\nAll the available classes implement both `IAuthorizationFilter` and `IDashboardAuthorizationFilter` interfaces, and compatible with Hangfire.Core 1.6 and later.\n\n## OWIN-based authentication\n\n```csharp\nusing Hangfire.Dashboard;\n\npublic void Configure(IAppBuilder app)\n{\n    var options = new DashboardOptions\n    {\n        Authorization = new [] \n        {\n            new AuthorizationFilter { Users = \"admin, superuser\", Roles = \"advanced\" },\n            new ClaimsBasedAuthorizationFilter(\"name\", \"value\")\n        }\n    };\n    app.UseHangfireDashboard(\"/hangfire\", options);\n}\n```\n\n## Basic authentication\n\n *Note:* If you are using basic authentication together with OWIN security, configure Hangfire *BEFORE* OWIN security configuration.\n \nPlease, keep in mind, if you have no SSL-based instance for your web application you have to disable `SslRedirect` and `RequireSsl` options (it's enabled by default for security reasons). Otherwise you will have dead redirect.\n\n```csharp\nvar filter = new BasicAuthAuthorizationFilter(\n    new BasicAuthAuthorizationFilterOptions\n    {\n        // Require secure connection for dashboard\n        RequireSsl = true,\n        // Case sensitive login checking\n        LoginCaseSensitive = true,\n        // Users\n        Users = new[]\n        {\n            new BasicAuthAuthorizationUser\n            {\n                Login = \"Administrator-1\",\n                // Password as plain text, SHA1 will be used\n                PasswordClear = \"test\"\n            },\n            new BasicAuthAuthorizationUser\n            {\n                Login = \"Administrator-2\",\n                // Password as SHA1 hash\n                Password = new byte[]{0xa9,\n                    0x4a, 0x8f, 0xe5, 0xcc, 0xb1, 0x9b,\n                    0xa6, 0x1c, 0x4c, 0x08, 0x73, 0xd3,\n                    0x91, 0xe9, 0x87, 0x98, 0x2f, 0xbb,\n                    0xd3}\n            }\n        }\n});\n```\n\nIt is also possible to use other than `SHA1` crypto provider by specifying it when creating a user:\n\n```csharp\nvar user = new BasicAuthAuthorizationUser(HMAC.Create)\n{\n    Login = \"Admin\",\n    PasswordClear = \"Password\" // HMAC will be used instead\n}\n```\n\n### How to generate password hash\n\nJust run this code:\n\n```csharp\nstring password = \"\u003cyour password here\u003e\";\nusing (var cryptoProvider = System.Security.Cryptography.SHA1.Create())\n{\n    byte[] passwordHash = cryptoProvider.ComputeHash(Encoding.UTF8.GetBytes(password));\n    string result = \"new byte[] { \" + \n        String.Join(\",\", passwordHash.Select(x =\u003e \"0x\" + x.ToString(\"x2\")).ToArray())\n         + \" } \";\n}\n```\n\nThe `result` variable will contain byte array definition with your password.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHangfireIO%2FHangfire.Dashboard.Authorization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHangfireIO%2FHangfire.Dashboard.Authorization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHangfireIO%2FHangfire.Dashboard.Authorization/lists"}