Gem Version Vulnerabilities Build Status Test Coverage Code Climate

Obscured::Doorman

Requirements

  • geocoder
  • haml
  • mongoid
  • sinatra
  • sinatra-contrib
  • sinatra-flash
  • sinatra-partial
  • rack
  • rack-contrib
  • rest-client
  • warden

Installation

  1. Add this line to your application's Gemfile:

    gem 'obscured-doorman'
    
  2. Execute:

    $ bundle
    
  3. Require the library in your application:

    require 'obscured-doorman'
    

Example

There are example html- and mail-templates in /example, look at these to get your started.

Configuration

The default configuration requires a mongoid client named :doorman, this will save users in a collection named 'users'

Obscured::Doorman.setup do |cfg|
  cfg.registration    = false
  cfg.confirmation    = false
end

Optional Configuration & Overrides

Obscured::Doorman.setup do |cfg|
  ...
  cfg.providers       = [
    Obscured::Doorman::Providers::Bitbucket.setup do |c|
      c.enabled         = nil
      c.client_id       = nil
      c.client_secret   = nil
      c.domains         = nil
    end,
    Obscured::Doorman::Providers::GitHub.setup do |c|
      c.enabled         = nil
      c.client_id       = nil
      c.client_secret   = nil
      c.domains         = nil
    end
  ]
  ...
end

All possible configurations

These values are representing the default values as well as all possible configurations.

Obscured::Doorman.setup do |cfg|
  cfg.registration    = false
  cfg.confirmation    = false
  cfg.db_name         = 'doorman'
  cfg.db_client       = :doorman,
  cfg.smtp_domain      = 'doorman.local'
  cfg.smtp_server     = '127.0.0.1'
  cfg.smtp_username   = nil
  cfg.smtp_password   = nil
  cfg.smtp_port       = 25
  cfg.remember_cookie = 'sinatra.doorman.remember'
  cfg.remember_for    = 30
  cfg.use_referrer    = true
  cfg.providers       = [
    Obscured::Doorman::Providers::Bitbucket.setup do |c|
      c.enabled         = false
      c.client_id       = nil
      c.client_secret   = nil
      c.domains         = nil
    end,
    Obscured::Doorman::Providers::GitHub.setup do |c|
      c.enabled         = false
      c.client_id       = nil
      c.client_secret   = nil
      c.domains         = nil
    end
  ],
  cfg.paths = {
    :success => '/home',
    :login   => '/doorman/login',
    :logout  => '/doorman/logout',
    :forgot  => '/doorman/forgot',
    :reset   => '/doorman/reset'
  }
)

TODO

  • Rewrite some parts to keep the gem dependencies down.
    • Rewrite to drop dependencies to rest-client.