From def9d1652d942717d04f58ef5a265e8ef0fefa48 Mon Sep 17 00:00:00 2001 From: Ant Barnes Date: Tue, 29 Mar 2022 16:14:04 +0100 Subject: [PATCH 1/3] Amend hydra request for v1 --- app/helpers/oauth_user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/oauth_user.rb b/app/helpers/oauth_user.rb index 22cd9ecd..eaab9acd 100644 --- a/app/helpers/oauth_user.rb +++ b/app/helpers/oauth_user.rb @@ -19,7 +19,7 @@ def hydra_request res = con.post do |req| req.url '/oauth2/introspect' req.headers['Content-Type'] = 'application/x-www-form-urlencoded' - req.headers['Authorization'] = "Basic #{ENV.fetch('HYDRA_SECRET')}" + req.headers['apiKey'] = "#{ENV.fetch('HYDRA_SECRET')}" req.body = { token: request.headers['Authorization'] } end JSON.parse(res.body) From 2b17566b65d8115b36a5c55375373283d39ab00b Mon Sep 17 00:00:00 2001 From: Ant Barnes Date: Tue, 29 Mar 2022 16:20:52 +0100 Subject: [PATCH 2/3] rubocop fix --- app/helpers/oauth_user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/oauth_user.rb b/app/helpers/oauth_user.rb index eaab9acd..cd12594a 100644 --- a/app/helpers/oauth_user.rb +++ b/app/helpers/oauth_user.rb @@ -19,7 +19,7 @@ def hydra_request res = con.post do |req| req.url '/oauth2/introspect' req.headers['Content-Type'] = 'application/x-www-form-urlencoded' - req.headers['apiKey'] = "#{ENV.fetch('HYDRA_SECRET')}" + req.headers['apiKey'] = ENV.fetch('HYDRA_SECRET').to_s req.body = { token: request.headers['Authorization'] } end JSON.parse(res.body) From 90ec49279220643bcb372ce3835953a41a33d9d4 Mon Sep 17 00:00:00 2001 From: Ant Barnes Date: Tue, 29 Mar 2022 16:21:28 +0100 Subject: [PATCH 3/3] Why call to_s on a string --- app/helpers/oauth_user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/oauth_user.rb b/app/helpers/oauth_user.rb index cd12594a..95308004 100644 --- a/app/helpers/oauth_user.rb +++ b/app/helpers/oauth_user.rb @@ -19,7 +19,7 @@ def hydra_request res = con.post do |req| req.url '/oauth2/introspect' req.headers['Content-Type'] = 'application/x-www-form-urlencoded' - req.headers['apiKey'] = ENV.fetch('HYDRA_SECRET').to_s + req.headers['apiKey'] = ENV.fetch('HYDRA_SECRET') req.body = { token: request.headers['Authorization'] } end JSON.parse(res.body)