Sha256: 3833e635595036166d3abf19e97ee90031c511e6b612bb9ac35c1ce1a2d25f31

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

module RealSavvy
  module JWT
    module Config
      def self.public_key
        if block_given?
          @public_key = Proc.new
        else
          result = @public_key.is_a?(Proc) ? @public_key.call : @public_key
          result.is_a?(OpenSSL::PKey::RSA) ? result : OpenSSL::PKey::RSA.new(result)
        end
      end

      def self.public_key= value
        @public_key = value
      end

      def self.retrieve_audience claims = nil
        if block_given?
          @retrieve_audience = Proc.new
        else
          @retrieve_audience.call(claims)
        end
      end

      def self.retrieve_audience= value
        @retrieve_audience = value
      end

      def self.retrieve_subject claims = nil
        if block_given?
          @retrieve_subject = Proc.new
        else
          @retrieve_subject.call(claims)
        end
      end

      def self.retrieve_subject= value
        @retrieve_subject = value
      end

      def self.validate_token token = nil
        if block_given?
          @validate_token = Proc.new
        else
          @validate_token.call(token)
        end
      end

      def self.validate_token= value
        @validate_token = value
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
real_savvy-0.0.9 lib/real_savvy/jwt/config.rb
real_savvy-0.0.8 lib/real_savvy/jwt/config.rb
real_savvy-0.0.7 lib/real_savvy/jwt/config.rb