redirect to AgentConnect
This commit is contained in:
parent
45ce274721
commit
898df449d4
4 changed files with 21 additions and 0 deletions
|
@ -1,4 +1,8 @@
|
|||
class AgentConnect::AgentController < ApplicationController
|
||||
def index
|
||||
end
|
||||
|
||||
def login
|
||||
redirect_to AgentConnectService.authorization_uri
|
||||
end
|
||||
end
|
||||
|
|
5
app/models/agent_connect_client.rb
Normal file
5
app/models/agent_connect_client.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AgentConnectClient < OpenIDConnect::Client
|
||||
def initialize
|
||||
super(AGENT_CONNECT)
|
||||
end
|
||||
end
|
|
@ -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
|
||||
|
|
|
@ -131,6 +131,7 @@ Rails.application.routes.draw do
|
|||
|
||||
namespace :agent_connect do
|
||||
get '' => 'agent#index'
|
||||
get 'login' => 'agent#login'
|
||||
end
|
||||
|
||||
namespace :champs do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue