Class: OAuth2::Provider

Inherits:
Object
  • Object
show all
Defined in:
lib/oauth2/provider.rb,
lib/oauth2/provider/error.rb,
lib/oauth2/provider/exchange.rb,
lib/oauth2/provider/access_token.rb,
lib/oauth2/provider/authorization.rb

Defined Under Namespace

Classes: AccessToken, Assertion, Authorization, Error, Exchange

Constant Summary collapse

EXPIRY_TIME =
3600

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.enforce_sslObject

Returns the value of attribute enforce_ssl.



67
68
69
# File 'lib/oauth2/provider.rb', line 67

def enforce_ssl
  @enforce_ssl
end

.realmObject

Returns the value of attribute realm.



67
68
69
# File 'lib/oauth2/provider.rb', line 67

def realm
  @realm
end

Class Method Details

.access_token(*args) ⇒ Object



105
106
107
# File 'lib/oauth2/provider.rb', line 105

def self.access_token(*args)
  Router.access_token(*args)
end

.clear_assertion_handlers!Object



70
71
72
73
74
# File 'lib/oauth2/provider.rb', line 70

def self.clear_assertion_handlers!
  @password_handler   = nil
  @assertion_handlers = {}
  @assertion_filters  = []
end

.filter_assertions(&filter) ⇒ Object



87
88
89
# File 'lib/oauth2/provider.rb', line 87

def self.filter_assertions(&filter)
  @assertion_filters.push(filter)
end

.handle_assertion(client, assertion) ⇒ Object



95
96
97
98
99
# File 'lib/oauth2/provider.rb', line 95

def self.handle_assertion(client, assertion)
  return nil unless @assertion_filters.all? { |f| f.call(client) }
  handler = @assertion_handlers[assertion.type]
  handler ? handler.call(client, assertion.value) : nil
end

.handle_assertions(assertion_type, &handler) ⇒ Object



91
92
93
# File 'lib/oauth2/provider.rb', line 91

def self.handle_assertions(assertion_type, &handler)
  @assertion_handlers[assertion_type] = handler
end

.handle_password(client, username, password) ⇒ Object



82
83
84
85
# File 'lib/oauth2/provider.rb', line 82

def self.handle_password(client, username, password)
  return nil unless @password_handler
  @password_handler.call(client, username, password)
end

.handle_passwords(&block) ⇒ Object



78
79
80
# File 'lib/oauth2/provider.rb', line 78

def self.handle_passwords(&block)
  @password_handler = block
end

.parse(*args) ⇒ Object



101
102
103
# File 'lib/oauth2/provider.rb', line 101

def self.parse(*args)
  Router.parse(*args)
end