rootstrap/apple_sign_in

View on GitHub
lib/apple_auth/helpers/conditions/iss_condition.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

module AppleAuth
  module Conditions
    class IssCondition
      APPLE_ISS = 'https://appleid.apple.com'

      def initialize(jwt)
        @iss = jwt['iss']
      end

      def validate!
        return true if @iss.include?(APPLE_ISS)

        raise JWTValidationError, 'jwt_iss is different to apple_iss'
      end
    end
  end
end