Class: Songkick::OAuth2::Provider

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

Defined Under Namespace

Classes: AccessToken, Assertion, Authorization, Error, Exchange

Constant Summary

EXPIRY_TIME =
3600

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.enforce_sslObject

Returns the value of attribute enforce_ssl



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

def enforce_ssl
  @enforce_ssl
end

.realmObject

Returns the value of attribute realm



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

def realm
  @realm
end

Class Method Details

.access_token(*args) ⇒ Object



125
126
127
# File 'lib/songkick/oauth2/provider.rb', line 125

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

.access_token_from_request(*args) ⇒ Object



129
130
131
# File 'lib/songkick/oauth2/provider.rb', line 129

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

.clear_assertion_handlers!Object



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

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

.filter_assertions(&filter) ⇒ Object



107
108
109
# File 'lib/songkick/oauth2/provider.rb', line 107

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

.handle_assertion(client, assertion, scopes) ⇒ Object



115
116
117
118
119
# File 'lib/songkick/oauth2/provider.rb', line 115

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

.handle_assertions(assertion_type, &handler) ⇒ Object



111
112
113
# File 'lib/songkick/oauth2/provider.rb', line 111

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

.handle_password(client, username, password, scopes) ⇒ Object



102
103
104
105
# File 'lib/songkick/oauth2/provider.rb', line 102

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

.handle_passwords(&block) ⇒ Object



98
99
100
# File 'lib/songkick/oauth2/provider.rb', line 98

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

.parse(*args) ⇒ Object



121
122
123
# File 'lib/songkick/oauth2/provider.rb', line 121

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