Class: Apress::Api::AuthService

Inherits:
Object
  • Object
show all
Defined in:
app/services/apress/api/auth_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



7
8
9
# File 'app/services/apress/api/auth_service.rb', line 7

def client
  @client
end

Instance Method Details

#access_idObject



26
27
28
# File 'app/services/apress/api/auth_service.rb', line 26

def access_id
  @access_id ||= ApiAuth.access_id(request) || query_parameters[:access_id]
end

#callObject

Find Client by access_id, check sercret_key

Returns boolean



14
15
16
17
18
19
20
21
22
23
24
# File 'app/services/apress/api/auth_service.rb', line 14

def call
  return false unless access_id

  @client = Apress::Api::Client.find_by_access_id(access_id)
  return false unless client

  return false if client.secret_token_expired?

  return true if not_check_signature?
  ::ApiAuth.authentic?(request, client.secret_token)
end