Module: WineBouncer::AuthMethods

Defined in:
lib/wine_bouncer/auth_methods/auth_methods.rb

Instance Method Summary collapse

Instance Method Details

#client_credential_token?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/wine_bouncer/auth_methods/auth_methods.rb', line 18

def client_credential_token?
  has_doorkeeper_token? && doorkeeper_access_token.resource_owner_id.nil?
end

#doorkeeper_access_tokenObject



22
23
24
# File 'lib/wine_bouncer/auth_methods/auth_methods.rb', line 22

def doorkeeper_access_token
  @_doorkeeper_access_token
end

#doorkeeper_access_token=(token) ⇒ Object



26
27
28
# File 'lib/wine_bouncer/auth_methods/auth_methods.rb', line 26

def doorkeeper_access_token=(token)
  @_doorkeeper_access_token = token
end

#has_doorkeeper_token?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/wine_bouncer/auth_methods/auth_methods.rb', line 30

def has_doorkeeper_token?
  !@_doorkeeper_access_token.nil?
end

#has_resource_owner?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/wine_bouncer/auth_methods/auth_methods.rb', line 34

def has_resource_owner?
  has_doorkeeper_token? && !!doorkeeper_access_token.resource_owner_id
end

#protected_endpoint=(protected) ⇒ Object



6
7
8
# File 'lib/wine_bouncer/auth_methods/auth_methods.rb', line 6

def protected_endpoint=(protected)
  @protected_endpoint = protected
end

#protected_endpoint?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/wine_bouncer/auth_methods/auth_methods.rb', line 10

def protected_endpoint?
  @protected_endpoint || false
end

#resource_ownerObject



14
15
16
# File 'lib/wine_bouncer/auth_methods/auth_methods.rb', line 14

def resource_owner
   instance_eval(&WineBouncer.configuration.defined_resource_owner)
end