Class: Apress::Api::AuthService
- Inherits:
-
Object
- Object
- Apress::Api::AuthService
- Defined in:
- app/services/apress/api/auth_service.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #access_id ⇒ Object
-
#call ⇒ Object
Find Client by access_id, check sercret_key.
Instance Attribute Details
#client ⇒ Object (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_id ⇒ Object
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 |
#call ⇒ Object
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 |