Class: Admin::SsoProvidersController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/generators/open_loam/install/templates/admin/sso_providers_controller.rb

Overview

Configure this tenant's SSO (OIDC) provider — manager-only, since it governs who can sign in and at what role. Tenant-scoped by OpenLoam::SsoProvider's default scope, so a manager only ever sees and edits their own tenant's connection. The client_secret is WRITE-ONLY: it is encrypted at rest and never rendered back, so editing without retyping it leaves the stored secret untouched.

Constant Summary

Constants included from Pagination

Pagination::PER_PAGE

Instance Method Summary collapse

Methods inherited from BaseController

skip_authorization!

Methods included from Pagination

#paginate

Instance Method Details

#create ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/generators/open_loam/install/templates/admin/sso_providers_controller.rb', line 25

def create
  @provider = OpenLoam::SsoProvider.new(provider_params)
  if @provider.save
    redirect_to admin_sso_providers_path, notice: "SSO provider created."
  else
    render :new, status: :unprocessable_entity
  end
end

#destroy ⇒ Object



44
45
46
47
# File 'lib/generators/open_loam/install/templates/admin/sso_providers_controller.rb', line 44

def destroy
  @provider.destroy!
  redirect_to admin_sso_providers_path, notice: "SSO provider deleted."
end

#edit ⇒ Object



34
# File 'lib/generators/open_loam/install/templates/admin/sso_providers_controller.rb', line 34

def edit; end

#index ⇒ Object



17
18
19
# File 'lib/generators/open_loam/install/templates/admin/sso_providers_controller.rb', line 17

def index
  @providers = OpenLoam::SsoProvider.order(:domain)
end

#new ⇒ Object



21
22
23
# File 'lib/generators/open_loam/install/templates/admin/sso_providers_controller.rb', line 21

def new
  @provider = OpenLoam::SsoProvider.new(protocol: "oidc", active: true, jit_role: "employee")
end

#update ⇒ Object



36
37
38
39
40
41
42
# File 'lib/generators/open_loam/install/templates/admin/sso_providers_controller.rb', line 36

def update
  if @provider.update(provider_params)
    redirect_to admin_sso_providers_path, notice: "SSO provider updated."
  else
    render :edit, status: :unprocessable_entity
  end
end