Sha256: 673550cb3182481254bbc5696fe1933062a24d94c6d626b7f1345a2ba0f38032

Contents?: true

Size: 603 Bytes

Versions: 10

Compression:

Stored size: 603 Bytes

Contents

# frozen_string_literal: true

module Warden
  module JWTAuth
    # Revokes a JWT using configured revocation strategy
    class TokenRevoker
      include JWTAuth::Import['revocation_strategies']

      # Revokes the JWT token
      #
      # @param token [String] a JWT
      def call(token)
        payload = TokenDecoder.new.call(token)
        scope = payload['scp'].to_sym
        user = PayloadUserHelper.find_user(payload)
        revocation_strategies[scope].revoke_jwt(payload, user)
      # rubocop:disable Lint/HandleExceptions
      rescue JWT::ExpiredSignature
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
warden-jwt_auth-0.3.4 lib/warden/jwt_auth/token_revoker.rb
warden-jwt_auth-0.3.3 lib/warden/jwt_auth/token_revoker.rb
warden-jwt_auth-0.3.2 lib/warden/jwt_auth/token_revoker.rb
warden-jwt_auth-0.3.1 lib/warden/jwt_auth/token_revoker.rb
warden-jwt_auth-0.3.0 lib/warden/jwt_auth/token_revoker.rb
warden-jwt_auth-0.2.1 lib/warden/jwt_auth/token_revoker.rb
warden-jwt_auth-0.2.0 lib/warden/jwt_auth/token_revoker.rb
warden-jwt_auth-0.1.4 lib/warden/jwt_auth/token_revoker.rb
warden-jwt_auth-0.1.3 lib/warden/jwt_auth/token_revoker.rb
warden-jwt_auth-0.1.2 lib/warden/jwt_auth/token_revoker.rb