{"id":20672096,"url":"https://github.com/workarea-commerce/workarea-basic-auth","last_synced_at":"2025-10-14T11:07:50.952Z","repository":{"id":56898461,"uuid":"203647223","full_name":"workarea-commerce/workarea-basic-auth","owner":"workarea-commerce","description":null,"archived":false,"fork":false,"pushed_at":"2020-01-03T18:18:50.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-31T02:23:11.275Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/workarea-commerce.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-21T19:01:29.000Z","updated_at":"2020-01-03T18:18:50.000Z","dependencies_parsed_at":"2022-08-21T02:20:43.307Z","dependency_job_id":null,"html_url":"https://github.com/workarea-commerce/workarea-basic-auth","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/workarea-commerce/workarea-basic-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workarea-commerce%2Fworkarea-basic-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workarea-commerce%2Fworkarea-basic-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workarea-commerce%2Fworkarea-basic-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workarea-commerce%2Fworkarea-basic-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/workarea-commerce","download_url":"https://codeload.github.com/workarea-commerce/workarea-basic-auth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/workarea-commerce%2Fworkarea-basic-auth/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269654009,"owners_count":24454317,"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-09T02:00:10.424Z","response_time":111,"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":[],"created_at":"2024-11-16T20:31:59.820Z","updated_at":"2025-10-14T11:07:45.931Z","avatar_url":"https://github.com/workarea-commerce.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Workarea Basic Auth\n================================================================================\n\nA Workarea Commerce plugin that adds middleware to enable HTTP Basic Auth for the Workarea Commerce platform, preventing undesired traffic (like bots) on staging and QA environments.\n\nGetting Started\n--------------------------------------------------------------------------------\n\nAdd the gem to your application's Gemfile:\n\n```ruby\n# ...\ngem 'workarea-basic_auth'\n# ...\n```\n\nUpdate your application's bundle.\n\n```bash\ncd path/to/application\nbundle\n```\n\nConfiguration\n--------------------------------------------------------------------------------\n\nBy default, `workarea-basic-auth` is disabled. To require basic authentication for routes in your application, set the following properties in `Workarea.config`:\n\n```ruby\nWorkarea.configure do |config|\n  config.basic_auth.enabled = true\n  config.basic_auth.user = 'my_username'\n  config.basic_auth.pass = 'my_password'\n  config.basic_auth.protect_routes.add('/products')\n  config.basic_auth.protect_routes.add('/categories')\n  config.basic_auth.protect_routes.add('/contact')\n  config.basic_auth.exclude_routes.add('/api*')\n  config.basic_auth.exclude_routes.add('/products/my-sweet-product')\nend\n```\n\nThe configuration above will require HTTP basic auth for all routes and HTTP methods other than those that start with `/api` or `/products/my-sweet-product`.\n\n### Excluding Assets\n\nNeed to exclude assets from http basic auth?\n\n```ruby\nWorkarea.configure do |config|\n  config.basic_auth.enabled = true\n  config.basic_auth.user = 'my_username'\n  config.basic_auth.pass = 'my_password'\n  config.basic_auth.exclude_routes.add('/assets/*')\nend\n```\n\n\n### Excluding routes based off HTTP method\n\nYou can also specify protecting or excluding protection of routes for specific\nHTTP methods:\n\n```ruby\nWorkarea.configure do |config|\n  config.basic_auth.enabled = true\n  config.basic_auth.user = 'my_username'\n  config.basic_auth.pass = 'my_password'\n  config.basic_auth.protect_routes.add('/login', :post, :option)\n  config.basic_auth.protect_routes.add('/contact', :put)\nend\n```\n\nThe configuration above will require HTTP basic auth when sending a\n`POST` or `OPTION` request to `/login` or a `PUT` request to `/contact`.\n\n### Excluding routes based off a Proc\n\nSometimes you may run into a case where path/method just won't cut it. You can\npass a protect or exclude route a proc that will be passed a Rack::Request object.\nAnytime the proc returns true, that path will match for either protection or exclusion.\n\nFor example, in order to allow the AWS ElasticLoadBalancer the ability to check\nan instances health, we exclude basic auth protection from any request where the\nUser Agent contains 'ELB-HealthChecker':\n\n```ruby\nWorkarea.configure do |config|\n  config.basic_auth.enabled = true\n  config.basic_auth.user = 'my_username'\n  config.basic_auth.pass = 'my_password'\n  config.basic_auth.exclude_routes.add('/*', -\u003e(request) {\n    request.env['HTTP_USER_AGENT'].include?('ELB-HealthChecker')\n  })\nend\n```\n\nWorkarea Commerce Documentation\n--------------------------------------------------------------------------------\n\nSee [https://developer.workarea.com](https://developer.workarea.com) for Workarea Commerce documentation.\n\nLicense\n--------------------------------------------------------------------------------\n\nWorkarea Basic Auth is released under the [Business Software License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkarea-commerce%2Fworkarea-basic-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworkarea-commerce%2Fworkarea-basic-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworkarea-commerce%2Fworkarea-basic-auth/lists"}