From a3c113472455ebfec9222bf2e9ccf87707ca2097 Mon Sep 17 00:00:00 2001 From: Rick Carlino Date: Mon, 25 Sep 2017 10:04:12 -0500 Subject: [PATCH] Moar hound fixes, I guess. --- app/lib/session_token.rb | 8 ++++---- app/mutations/auth/from_jwt.rb | 2 +- spec/mutations/auth/from_jwt_spec.rb | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/lib/session_token.rb b/app/lib/session_token.rb index 7711f8fcd..0e4dcb105 100644 --- a/app/lib/session_token.rb +++ b/app/lib/session_token.rb @@ -1,14 +1,14 @@ # Generates a JSON Web Token (JWT) for a given user. Typically placed in the # `Authorization` header, or used a password to gain access to the MQTT server. class SessionToken < AbstractJwtToken - MUST_VERIFY = 'Verify account first' + MUST_VERIFY = "Verify account first" DEFAULT_OS = "https://api.github.com/repos/" \ "farmbot/farmbot_os/releases/latest" DEFAULT_FW = "https://api.github.com/repos/FarmBot/farmbot-arduino-firmware/"\ "releases/latest" - OS_RELEASE = ENV.fetch('OS_UPDATE_SERVER') { DEFAULT_OS } - FW_RELEASE = ENV.fetch('FW_UPDATE_SERVER') { DEFAULT_FW } - MQTT = ENV.fetch('MQTT_HOST') + OS_RELEASE = ENV.fetch("OS_UPDATE_SERVER") { DEFAULT_OS } + FW_RELEASE = ENV.fetch("FW_UPDATE_SERVER") { DEFAULT_FW } + MQTT = ENV.fetch("MQTT_HOST") EXPIRY = 40.days def self.issue_to(user, diff --git a/app/mutations/auth/from_jwt.rb b/app/mutations/auth/from_jwt.rb index 835682993..003093d50 100644 --- a/app/mutations/auth/from_jwt.rb +++ b/app/mutations/auth/from_jwt.rb @@ -7,7 +7,7 @@ module Auth def execute token = SessionToken.decode!(just_the_token) claims = token.unencoded - sub = claims['sub'] + sub = claims["sub"] case sub when Integer then User.find(sub) # HISTORICAL CONTEXT: We once used emails as a `sub` field. At the time, diff --git a/spec/mutations/auth/from_jwt_spec.rb b/spec/mutations/auth/from_jwt_spec.rb index d496698a0..f17ec27cc 100644 --- a/spec/mutations/auth/from_jwt_spec.rb +++ b/spec/mutations/auth/from_jwt_spec.rb @@ -3,7 +3,7 @@ require "spec_helper" describe Auth::FromJWT do let(:user) { FactoryGirl.create(:user) } let(:token) { SessionToken.issue_to(user).encoded } - fake = lambda (sub) { + fake = -> (sub) { AbstractJwtToken.new([{ sub: sub, iat: Time.now.to_i, jti: SecureRandom.uuid,