Class: NeetoJwtEngine::ConfigurationsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- NeetoJwtEngine::ConfigurationsController
- Includes:
- Authenticatable
- Defined in:
- app/controllers/neeto_jwt_engine/configurations_controller.rb
Constant Summary collapse
- MESSAGE =
<<~EOF This is a one-time link. DO NOT click on the link yourself. In case the link is expired, whether by accident or by mis-use, create a fresh public-private key pair using the /neeto-jwt/configurations/create route. EOF
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
26 27 28 29 30 31 32 |
# File 'app/controllers/neeto_jwt_engine/configurations_controller.rb', line 26 def create @organization.jwt_configuration&.onetime_link&.update!(expired: true) configuration = NeetoJwtEngine::Configuration.create!(organization: @organization) onetime_link = configuration.create_onetime_link! onetime_link = "#{request.base_url}/neeto_jwt/configurations/#{onetime_link.link}" render status: :ok, json: { message: MESSAGE, onetime_link: } end |
#show ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/neeto_jwt_engine/configurations_controller.rb', line 16 def show filename = "neeto-jwt-#{@organization.subdomain}-private.key" Tempfile.open(filename) do |file| file.write @configuration.private_key file.rewind send_data file.read, filename: end end |