From 38d054e178f6860a1e1b3ed160808509c920bcc1 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Thu, 23 Feb 2023 17:29:47 -0600 Subject: Añade servicio para generación de jwts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/services/token_generation_service.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 app/controllers/services/token_generation_service.rb diff --git a/app/controllers/services/token_generation_service.rb b/app/controllers/services/token_generation_service.rb new file mode 100644 index 0000000..2df2ea6 --- /dev/null +++ b/app/controllers/services/token_generation_service.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Services + # The service responsible for JWT generation. + class TokenGenerationService + def initialize(params) + @email = params[:email] + @role = params[:role] + end + + private + + def payload + { data: @email, aud: @role } + end + end +end -- cgit v1.2.3