redirect to AgentConnect

This commit is contained in:
simon lehericey 2021-11-19 10:21:47 +01:00
parent 45ce274721
commit 898df449d4
4 changed files with 21 additions and 0 deletions

View file

@ -1,4 +1,8 @@
class AgentConnect::AgentController < ApplicationController
def index
end
def login
redirect_to AgentConnectService.authorization_uri
end
end

View file

@ -0,0 +1,5 @@
class AgentConnectClient < OpenIDConnect::Client
def initialize
super(AGENT_CONNECT)
end
end

View file

@ -2,4 +2,15 @@ class AgentConnectService
def self.enabled?
ENV.fetch("AGENT_CONNECT_ENABLED", "enabled") == "enabled"
end
def self.authorization_uri
client = AgentConnectClient.new
client.authorization_uri(
scope: [:openid, :email],
state: SecureRandom.hex(16),
nonce: SecureRandom.hex(16),
acr_values: 'eidas1'
)
end
end

View file

@ -131,6 +131,7 @@ Rails.application.routes.draw do
namespace :agent_connect do
get '' => 'agent#index'
get 'login' => 'agent#login'
end
namespace :champs do