Module: OohAuth

Defined in:
lib/ooh-auth.rb,
lib/ooh-auth/key_generators.rb,
lib/ooh-auth/controller_mixin.rb,
lib/ooh-auth/request_verification_mixin.rb

Overview

OohAuth::KeyGenerators

A set of generators for common password types. Usage: OohAuth::KeyGenerators::<type>.new(length_if_applicable) where <type> is any of: Password: a memorable password such as 254yellowShoes or 869spaceageBiplanes Passphrase: a memorable passphrase made up of [length] words. Alphanum: a gibberish string [length] characters long.

Defined Under Namespace

Modules: ControllerMixin, KeyGenerators, Request Classes: Application, AuthenticatingClient, AuthenticatingClients, Token, Tokens

Class Method Summary collapse

Class Method Details

.activateObject

Activation hook - runs after AfterAppLoads BootLoader



79
80
# File 'lib/ooh-auth.rb', line 79

def self.activate
end

.deactivateObject

Deactivation hook - triggered by Merb::Slices.deactivate(OohAuth)



83
84
# File 'lib/ooh-auth.rb', line 83

def self.deactivate
end

.initObject

Initialization hook - runs before AfterAppLoads BootLoader



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/ooh-auth.rb', line 60

def self.init
  require "ooh-auth/authentication_mixin"
  require "ooh-auth/key_generators"
  require "ooh-auth/request_verification_mixin.rb"
  require "ooh-auth/controller_mixin.rb"
  require "ooh-auth/strategies/oauth.rb"
  Merb::Request.send(:include, OohAuth::Request::VerificationMixin)
  Merb::Controller.send(:include, OohAuth::ControllerMixin)
  
  # Register strategies
  Merb::Authentication.register :oauth, "ooh-auth/strategies/oauth.rb"
  Merb::Authentication.activate! :oauth
  
  unless OohAuth[:no_default_strategies]
    ::Merb::Authentication.activate!(:default_password_form)
  end
end

.loadedObject

Stub classes loaded hook - runs before LoadClasses BootLoader right after a slice’s classes have been loaded internally.



56
57
# File 'lib/ooh-auth.rb', line 56

def self.loaded
end

.setup_router(scope) ⇒ Object

Add the following to your app’s router to mount SliceRestful at the root: Merb::Router.prepare do

slice( :OohAuth, :name_prefix => nil, :path_prefix => "auth", :default_routes => false )

end



90
91
92
93
94
# File 'lib/ooh-auth.rb', line 90

def self.setup_router(scope)
  scope.resources :authenticating_clients
  scope.resources :tokens
  scope.default_routes
end