Module: OauthProviderEngine
- Defined in:
- lib/oauth_provider_engine.rb,
lib/oauth_provider_engine/engine.rb,
lib/oauth_provider_engine/version.rb,
app/models/oauth_provider_engine/base.rb,
app/models/oauth_provider_engine/application.rb,
app/models/oauth_provider_engine/access_token.rb,
app/models/oauth_provider_engine/request_token.rb
Defined Under Namespace
Classes: AccessToken, Application, Base, Engine, RequestToken
Constant Summary collapse
- VERSION =
"0.0.5"
Class Attribute Summary collapse
-
.access_token_expiry ⇒ Object
this setting lets you specify the expiry on an access_token defaults to no expiration.
-
.admin_authenticate_method ⇒ Object
this method is used to protect the applications controller.
-
.admin_layout ⇒ Object
these settings allow you to specify what layout to use for the applications resource and the oauth authorize page.
-
.authenticate_method ⇒ Object
this method is used to protect the oauth#authenticate action.
-
.oauth_layout ⇒ Object
Returns the value of attribute oauth_layout.
-
.user_method ⇒ Object
this proc should be used to fetch the uniq user id from the controller.
Class Method Summary collapse
Class Attribute Details
.access_token_expiry ⇒ Object
this setting lets you specify the expiry on an access_token
defaults to no expiration
26 27 28 |
# File 'lib/oauth_provider_engine.rb', line 26 def access_token_expiry @access_token_expiry end |
.admin_authenticate_method ⇒ Object
this method is used to protect the applications controller. if you do not protect the controller,
anyone can create their own applications (which is a valid scenario).
14 15 16 |
# File 'lib/oauth_provider_engine.rb', line 14 def admin_authenticate_method @admin_authenticate_method end |
.admin_layout ⇒ Object
these settings allow you to specify what layout to use for the applications resource and the
oauth page
21 22 23 |
# File 'lib/oauth_provider_engine.rb', line 21 def admin_layout @admin_layout end |
.authenticate_method ⇒ Object
this method is used to protect the oauth#authenticate action. you should check to
see if the user is logged in. if the user is not logged in, redirect them to
your login page. upon successful login, they should be redirected back to the
authenticate action with the same oauth_token param
10 11 12 |
# File 'lib/oauth_provider_engine.rb', line 10 def authenticate_method @authenticate_method end |
.oauth_layout ⇒ Object
Returns the value of attribute oauth_layout.
22 23 24 |
# File 'lib/oauth_provider_engine.rb', line 22 def oauth_layout @oauth_layout end |
.user_method ⇒ Object
this proc should be used to fetch the uniq user id from the controller
17 18 19 |
# File 'lib/oauth_provider_engine.rb', line 17 def user_method @user_method end |
Class Method Details
.configure(opts = {}) {|_self| ... } ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/oauth_provider_engine.rb', line 32 def configure(opts = {}) opts.each do |k,v| self.send("#{k}=", v) end yield self if block_given? end |
.generate_key(length = 32) ⇒ Object
28 29 30 |
# File 'lib/oauth_provider_engine.rb', line 28 def generate_key(length = 32) Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{rand(1000)}--")[0,length-1] end |