{"id":13778054,"url":"https://github.com/leemour/hanami_id","last_synced_at":"2025-09-29T18:31:49.582Z","repository":{"id":34873046,"uuid":"186051310","full_name":"leemour/hanami_id","owner":"leemour","description":"Hanami Authentication library","archived":false,"fork":false,"pushed_at":"2022-03-30T23:13:56.000Z","size":152,"stargazers_count":15,"open_issues_count":26,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-17T13:38:11.074Z","etag":null,"topics":["authentication","hanami","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/leemour.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-10T20:36:39.000Z","updated_at":"2020-07-28T18:09:50.000Z","dependencies_parsed_at":"2022-08-08T02:15:21.788Z","dependency_job_id":null,"html_url":"https://github.com/leemour/hanami_id","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leemour%2Fhanami_id","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leemour%2Fhanami_id/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leemour%2Fhanami_id/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leemour%2Fhanami_id/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leemour","download_url":"https://codeload.github.com/leemour/hanami_id/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253559841,"owners_count":21927685,"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":["authentication","hanami","ruby"],"created_at":"2024-08-03T18:00:50.824Z","updated_at":"2025-09-29T18:31:49.529Z","avatar_url":"https://github.com/leemour.png","language":"Ruby","funding_links":[],"categories":["Hanami Gem List"],"sub_categories":["Authentication and OAuth"],"readme":"# HanamiId\n\nAuthentication solution for [Hanami](https://github.com/hanami/hanami) framework. Based on [Warden](https://github.com/wardencommunity/warden) and [Bcrypt](https://github.com/codahale/bcrypt-ruby).\n\nHanamiId tries to be a plug-n-play solution like Devise is for Rails. But \ninstead of magic intervention, it generates a separate app with controllers, views, templates full of working code that you can easily change to your liking.  \nHanamiId doesn't monkey patch anything, doesn't mess with your app configuration \nand acts completely isolated.\n\n\n## Status\n\n[![Build Status](https://travis-ci.org/leemour/hanami_id.svg?branch=master)](https://travis-ci.org/leemour/hanami_id)\n[![Gem](https://img.shields.io/gem/v/hanami_id.svg?style=flat)](http://rubygems.org/gems/hanami_id \"View this project in Rubygems\")\n[![Known Vulnerabilities](https://snyk.io/test/github/leemour/hanami_id/badge.svg?targetFile=Gemfile.lock)](https://snyk.io/test/github/leemour/hanami_id?targetFile=Gemfile.lock)\n[![Depfu](https://badges.depfu.com/badges/49e1b40e2b5a6d6d7fd89e97531bb65a/count.svg)](https://depfu.com/github/leemour/hanami_id?project_id=7886)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/c05fdf7a87204e53b79cb4a77b44f41a)](https://www.codacy.com/app/leemour/hanami_id?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=leemour/hanami_id\u0026amp;utm_campaign=Badge_Grade)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/c4c03486c0bf75b6fb44/test_coverage)](https://codeclimate.com/github/leemour/hanami_id/test_coverage)\n[![Maintainability](https://api.codeclimate.com/v1/badges/c4c03486c0bf75b6fb44/maintainability)](https://codeclimate.com/github/leemour/hanami_id/maintainability)\n\n## Installation\n\nAdd these lines to your application's Gemfile:\n\n```ruby\ngem \"hanami_id\"\n\ngroup :plugins do\n  gem \"hanami_id-generators\"\nend\n```\n\nAnd then execute:\n\n    $ bundle\n\nRun generator:\n\n    $ hanami g auth --app auth --model user --modules=sessions,registrations --mode project\n\n\nUse `--help` to see all available options and defaults. They are:\n\n- --app\n- --model\n- --modules\n- --locale\n- --id_type\n- --login_column\n- --password_column\n\nThe above command is using Hanami CLI under the hood and will generate an \napplication with all controller actions, views, templates in `apps` folder. As well as entity, repository and interactors in `lib` fodler. All relevant specs are coming soon (RSpec, Capybara).\n\nAll available modules are:\n\n- sessions\n- registrations\n- passwords\n- confirmations\n- unlocks\n\nCurrently working modules are *sessions* and *registrations* only. Other modules' files are generated but functionality is either not implemented or not supported by mailers (mailing is to be added very soon).\n\nDuring generation, when `project` mode is used, the authentication helpers, I18n and Warden are instlled project-wide in `/config/environment.rb`. When `standalone` mode is used, they are installed only inside the authentication app e.g. `apps/auth/application.rb`.   If you need to add authentication to selected few apps, you can do it manually. Automatic handling of selected option is in coming soon.\n\n\n## Usage\n\nThe gem provides several helpers:\n - `authenticate_\u003cmodel\u003e!`\n - `authenticate_\u003cmodel\u003e`\n - `current_\u003cmodel\u003e`\n - `\u003cmodel\u003e_signed_in?`\n\nUse `authenticate_\u003cmodel\u003e!` method to fail if authentications fails and `authenticate_\u003cmodel\u003e` to proceed to normal application workflow even if authentication fails.\n\n`current_\u003cmodel\u003e` method is `nil` if no user is authenticated otherwise it represents the authenticated user.\n\nUse `\u003cmodel\u003e_signed_in?` to check if user is authenticated.\n\nIn case of `standalone` installation, auth app will be completely isolated and HanamiId will not be injected in other apps code. For authenication usage in a specific app add Warden Rack middleware to that app:\n```ruby\n# apps/web/application.rb\nmodule Web\n  class Application \u003c Hanami::Application\n    configure do\n      # ...\n      sessions :cookie, secret: ENV[\"WEB_SESSIONS_SECRET\"]\n      include HanamiId::Warden::AppHelper\n    end\n  end\nend\n```\n\nTo use authentication in all controller actions of an app do:\n```ruby\n# apps/web/application.rb\nmodule Auth\n  class Application \u003c Hanami::Application\n    configure do\n      controller.prepare do\n        before :authenticate_user!\n      end\n    end\n  end\nend\n```    \n\nTo force authentication inside a controller action use:\n```ruby\n# apps/web/controllers/dashboard/show.rb\nmodule Web\n  module Controllers\n    module Dashboard\n      class Show\n        before :authenticate_user!\n\n        def call(params)\n          # ...\n        end\n      end\n    end\n  end\nend\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/leemour/hanami_id. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## Code of Conduct\n\nEveryone interacting in the HanamiId project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/leemour/hanami_id/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleemour%2Fhanami_id","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleemour%2Fhanami_id","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleemour%2Fhanami_id/lists"}