Sha256: 4abdfb6cae3473a2cdf77f8220123e3dd56b4675d4e73a089da70251c70f34d3

Contents?: true

Size: 798 Bytes

Versions: 1

Compression:

Stored size: 798 Bytes

Contents

module RealSavvy
  module JWT
    class ShareToken < AbstractToken

      def short_token
        @token.split('.')[1]
      end

      private

      def retrieve_claims
        @claims, @header = ::JWT.decode(
                              token,
                              nil,
                              false,
                            )
      rescue ::JWT::DecodeError => e
        raise ::RealSavvy::JWT::BadCredentials.new(e.message)
      end

      def validate_token
        true
      end

      def standardized_token
        token_parts = @token.split('.')
        header = Base64.urlsafe_encode64({typ:"JWT",alg:"none"}.to_json, padding: false)
        @token = [header, (token_parts.length == 1 ? token_parts[0] : token_parts[1]), nil].join('.')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
real_savvy-0.0.7 lib/real_savvy/jwt/share_token.rb