From 4997a8163967a912f60ae2af124749f48b177d7d Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Mon, 18 Mar 2024 17:36:25 +0100 Subject: [PATCH] remove one indirection --- app/models/agent_connect_client.rb | 9 --------- app/services/agent_connect_service.rb | 5 +++-- 2 files changed, 3 insertions(+), 11 deletions(-) delete mode 100644 app/models/agent_connect_client.rb diff --git a/app/models/agent_connect_client.rb b/app/models/agent_connect_client.rb deleted file mode 100644 index f18eb4a63..000000000 --- a/app/models/agent_connect_client.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AgentConnectClient < OpenIDConnect::Client - def initialize(code = nil) - super(AGENT_CONNECT) - - if code.present? - self.authorization_code = code - end - end -end diff --git a/app/services/agent_connect_service.rb b/app/services/agent_connect_service.rb index 4873d8679..1838a72b7 100644 --- a/app/services/agent_connect_service.rb +++ b/app/services/agent_connect_service.rb @@ -6,7 +6,7 @@ class AgentConnectService end def self.authorization_uri - client = AgentConnectClient.new + client = OpenIDConnect::Client.new(AGENT_CONNECT) state = SecureRandom.hex(16) nonce = SecureRandom.hex(16) @@ -22,7 +22,8 @@ class AgentConnectService end def self.user_info(code, nonce) - client = AgentConnectClient.new(code) + client = OpenIDConnect::Client.new(AGENT_CONNECT) + client.authorization_code = code access_token = client.access_token!(client_auth_method: :secret)