Class: BrowserID::Config
- Inherits:
-
Hash
- Object
- Hash
- BrowserID::Config
- Defined in:
- lib/browserid-provider/config.rb
Overview
authentication_path Where to redirect users for login
defaults to: "/users/sign_in" (Devise default)
provision_path What HTTP path to deliver provisioning from
defaults to: "/browserid/provision"
certify_path What HTTP path to deliver certifying from
defaults to: "/browserid/certify"
whoami_path What HTTP path to serve user credentials at
defaults to: "/browserid/whoami"
jquery_path What HTTP path JQuery is served at
defaults to: "/assets/jquery.js"
whoami Name of the middleware to get the current user object from (:user must respond to :email method)
This middleware will be called as follows: env['warden'].user.email
defaults to: "warden"
private_key_path Where is the BrowserID OpenSSL private key located
defaults to: "config/browserid_provider.pem"
The “/.well-known/browserid” path is required from the BrowserID spec and used here.
browserid_url Which BrowserID server to use, ca be one of the following:
* login.dev.anosrep.org for development (default)
* login.anosrep.org for beta
* login.persona.org for production
server_name The domain name we are providing BrowserID for (default to example.org)
delegates Delegated domain names (see wiki.mozilla.org/Identity/BrowserID#BrowserID_Delegated_Support_Document)
defaults to: []
Class Method Summary collapse
-
.hash_accessor(*names) ⇒ Object
Creates an accessor that simply sets and reads a key in the hash:.
Instance Method Summary collapse
- #get_issuer(dom) ⇒ Object
-
#initialize(other = {}) ⇒ Config
constructor
A new instance of Config.
- #urls ⇒ Object
Constructor Details
#initialize(other = {}) ⇒ Config
Returns a new instance of Config.
65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/browserid-provider/config.rb', line 65 def initialize(other={}) merge!(other) self[:login_path] ||= "/users/sign_in" self[:provision_path] ||= "/browserid/provision" self[:certify_path] ||= "/browserid/certify" self[:whoami_path] ||= "/browserid/whoami" self[:jquery_path] ||= "/assets/jquery.js" self[:whoami] ||= "warden" self[:private_key_path] ||= "config/browserid_provider.pem" self[:browserid_url] ||= "login.dev.anosrep.org" self[:server_name] ||= "example.org" self[:delegates] ||= [] end |
Class Method Details
.hash_accessor(*names) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/browserid-provider/config.rb', line 49 def self.hash_accessor(*names) #:nodoc: names.each do |name| class_eval <<-METHOD, __FILE__, __LINE__ + 1 def #{name} self[:#{name}] end def #{name}=(value) self[:#{name}] = value end METHOD end end |
Instance Method Details
#get_issuer(dom) ⇒ Object
79 80 81 82 |
# File 'lib/browserid-provider/config.rb', line 79 def get_issuer(dom) return dom if ( [ self[:server_name] ] + self[:delegates] ).include?(dom) return self[:server_name] end |
#urls ⇒ Object
84 85 86 |
# File 'lib/browserid-provider/config.rb', line 84 def urls [ self[:provision_path], self[:certify_path], self[:whoami_path], "/.well-known/browserid" ] end |