Class: SlackMsgr::Authenticate
- Inherits:
-
Object
- Object
- SlackMsgr::Authenticate
- Defined in:
- lib/slack_msgr/authenticate.rb
Overview
Handles various authentication patterns offered by Slack
Class Method Summary collapse
Class Method Details
.signing_secret?(request) ⇒ Boolean
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/slack_msgr/authenticate.rb', line 11 def signing_secret?(request) signature = request.headers['X-Slack-Signature'] = request.headers['X-Slack-Request-Timestamp'] version = signature.split('=').first body = request.body.read # The request timestamp is more than five minutes from local time. # It could be a replay attack, so let's ignore it. return false if () signature == "#{version}=#{compute_hash_sha256(version, , body)}" end |
.verification_token?(token) ⇒ Boolean
7 8 9 |
# File 'lib/slack_msgr/authenticate.rb', line 7 def verification_token?(token) token == SlackMsgr.configuration.verification_token end |