class CreateProjectAuthenticationTokenCommand
Authentication implementation mostly copied and slightly adapted from paweljw.github.io/2017/07/rails-5.1-api-app-part-4-authentication-and-authorization/ Big thanks!
Attributes
project[R]
Public Class Methods
new(project)
click to toggle source
# File natural-backend/app/commands/create_project_authentication_token_command.rb, line 11 def initialize(project) @project = project end
Private Instance Methods
content()
click to toggle source
# File natural-backend/app/commands/create_project_authentication_token_command.rb, line 19 def content { project_id: project.id, exp: 1.year.from_now.to_i } end
run()
click to toggle source
# File natural-backend/app/commands/create_project_authentication_token_command.rb, line 15 def run @result = JwtService.encode(content) end