{"repo":"ueberauth/guardian_db","free":true,"listed":false,"github":"https://github.com/ueberauth/guardian_db","clone":"git clone https://github.com/ueberauth/guardian_db.git","description":"Guardian DB integration for tracking tokens and ensuring logout cannot be replayed.","language":"Elixir","stars":372,"topics":["guardian","database","guardian-db"],"license":"MIT","category":"databases-storage","readme_excerpt":"Guardian.DB Guardian.DB is an extension to Guardian that tracks tokens in your application's database to prevent playback. Installation Guardian.DB assumes that you are using the Guardian framework for authentication. To install Guardian.DB , first add it to your mix.exs file: Then run mix deps.get on your terminal. Configure your application as seen in the Configuration section below prior to attempting to generate the migration or you will get an application was not loaded/started error. Following configuration add the Guardian migration: run mix guardian.db.gen.migration to generate a migration. Do not run the migration yet, we need to complete our setup first. Configuration To use ETS instead of Ecto for storing tokens, you can set adapter to Guardian.DB.ETSAdapter . To sweep expired tokens from your db you should add Guardian.DB.Sweeper to your supervision tree. Guardian.DB works by hooking into the lifecycle of your Guardian module. You'll need to add it to: after encode and sign on verify on refresh on revoke For example: Now run the migration and you'll be good to go. Custom schema name Guardian.DB allows custom schema name in migrations, based on following configuration: And when you run the migration, it'll generate the following migration: Then, run the migration and you'll be good to go. Considerations Guardian is already a very robust JWT solution. However, if your application needs the ability to immediately revoke and invalidate tokens that have already been ge","default_branch":null,"files":null,"tree":[],"storefront":"/r/ueberauth","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/ueberauth/guardian_db/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}