Clean up specs

This commit is contained in:
2023-06-14 22:08:39 +10:00
parent 7c1a638b58
commit 2eaf1ddf88
6 changed files with 14 additions and 15 deletions

View File

@@ -6,7 +6,7 @@ require "httparty"
require "dry-monads"
require "dry-matcher"
require "dry/matcher/result_matcher"
require "pry"
module Adamantium
class Action < Hanami::Action
include Deps["logger",
@@ -22,6 +22,8 @@ module Adamantium
handle_exception StandardError => :handle_error
def authenticate!(req, res)
halt 400 if req.env["HTTP_AUTHORIZATION"] && req.params[:access_token]
if Hanami.env == :development || Hanami.env == :test
req.env[:scopes] = verify_token(nil)
return true
@@ -29,8 +31,6 @@ module Adamantium
# Pull out and verify the authorization header or access_token
halt 400 if req.env["HTTP_AUTHORIZATION"] && req.params["access_token"]
if req.env["HTTP_AUTHORIZATION"]
header = req.env["HTTP_AUTHORIZATION"].match(/Bearer (.*)$/)
access_token = header[1] unless header.nil?