Project

tyrant

0.04
No commit activity in last 3 years
No release in over 3 years
Agnostic authorization component for Trailblazer.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.10
~> 10.0

Runtime

>= 0
>= 0.1.11
~> 2.0
>= 0
 Project Readme

Tyrant

"Freedom choked in dread we live, since tyrant was enthroned."

Tyrant implements all common steps of authorization workflows using overridable operations. It allows a quick setup of sign in, sign up, forgot password, etc. Tyrant works well in Rails, but plays well with any Ruby environment.

Operations are provided for the following steps.

  • SignIn
    • Confirmed
    • Hammer protection (3x wrong blabla)
    • Sticky (Remember me)
  • SignUp
  • SignOut
  • ResetPassword
  • Forgot pw
  • Multiple sessions with scopes

Operations

trb instead of pushing into controller

Tyrant exposes its public API using operations.

Operations are the pivotal element in the Trailblazer architecture. When it comes to customization, Tyrant doesn't rely on a "hopefully complete" configuration language as Devise does it.

Tyrant allows you to customize with Ruby. You can override entire workflow steps (operations), forms and validations (contracts) or methods using simple object-orientation and a clean API.

This means you can easily use them in Rails controllers.

class SessionController < ApplicationController
  def sign_in
    run Tyrant::SignIn
  end

You can also run the public API in any other Ruby environment, e.g. a console or a Roda action.

Tyrant::SignIn.run(params)

Tyrant provides forms for all workflow steps. using Reform objects that are embedded into the operations.

=> Customize with inheritance, or override. Or just don't use the operation and write your own "step".

Installation

Add this line to your application's Gemfile:

gem 'tyrant'

Rails

Tyrant comes with a railtie to provide you an initializer. In Rails, add this to an initializer.

require "tyrant/railtie"

License

The gem is available as open source under the terms of the MIT License.