Moar hound fixes, I guess.

pull/467/head
Rick Carlino 2017-09-25 10:04:12 -05:00
parent bf27cd8d0e
commit a3c1134724
3 changed files with 6 additions and 6 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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,