Sha256: c36392024485af4efd721bbc48f237721e7c5f42f2e978be481a0237141c38c5

Contents?: true

Size: 681 Bytes

Versions: 22

Compression:

Stored size: 681 Bytes

Contents

EXPIRATION_IN_SECONDS = 1.hours

module ForestLiana
  class Token
    REGEX_COOKIE_SESSION_TOKEN = /forest_session_token=([^;]*)/;

    def self.expiration_in_days
      Time.current + EXPIRATION_IN_SECONDS
    end

    def self.expiration_in_seconds
      return Time.now.to_i + EXPIRATION_IN_SECONDS
    end

    def self.create_token(user, rendering_id)
      return JWT.encode({
        id: user['id'],
        email: user['email'],
        first_name: user['first_name'],
        last_name: user['last_name'],
        team: user['teams'][0],
        rendering_id: rendering_id,
        exp: expiration_in_seconds()
      }, ForestLiana.auth_secret, 'HS256')
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
forest_liana-6.5.1 app/services/forest_liana/token.rb
forest_liana-7.0.0.beta.2 app/services/forest_liana/token.rb
forest_liana-6.5.0 app/services/forest_liana/token.rb
forest_liana-6.4.1 app/services/forest_liana/token.rb
forest_liana-7.0.0.beta.1 app/services/forest_liana/token.rb
forest_liana-6.4.0 app/services/forest_liana/token.rb
forest_liana-6.3.8 app/services/forest_liana/token.rb
forest_liana-6.3.7 app/services/forest_liana/token.rb
forest_liana-6.3.6 app/services/forest_liana/token.rb
forest_liana-6.3.5 app/services/forest_liana/token.rb
forest_liana-6.3.4 app/services/forest_liana/token.rb
forest_liana-6.3.3 app/services/forest_liana/token.rb
forest_liana-6.3.2 app/services/forest_liana/token.rb
forest_liana-6.3.1 app/services/forest_liana/token.rb
forest_liana-6.3.0 app/services/forest_liana/token.rb
forest_liana-6.2.3 app/services/forest_liana/token.rb
forest_liana-6.2.2 app/services/forest_liana/token.rb
forest_liana-6.2.1 app/services/forest_liana/token.rb
forest_liana-6.2.0 app/services/forest_liana/token.rb
forest_liana-6.1.1 app/services/forest_liana/token.rb