Module: JWTSignedRequest

Extended by:
JWTSignedRequest
Included in:
JWTSignedRequest
Defined in:
lib/jwt_signed_request/headers.rb,
lib/jwt_signed_request.rb,
lib/jwt_signed_request/sign.rb,
lib/jwt_signed_request/claims.rb,
lib/jwt_signed_request/errors.rb,
lib/jwt_signed_request/verify.rb,
lib/jwt_signed_request/version.rb,
lib/jwt_signed_request/key_store.rb,
lib/jwt_signed_request/middlewares/rack.rb,
lib/jwt_signed_request/middlewares/faraday.rb

Overview

We need a way to pull out the headers from a RAW Rack ENV hash.

We took out the bits we need to lookup the headers from: github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/http/headers.rb

We didn’t want to include actionpack as a dependency of the library as it brings in alot of other dependencies.

Defined Under Namespace

Modules: Middlewares Classes: Claims, Headers, KeyStore, Sign, Verify

Constant Summary collapse

DEFAULT_ALGORITHM =
'ES256'
EMPTY_BODY =
''
UnauthorizedRequestError =
Class.new(StandardError)
MissingAuthorizationHeaderError =
Class.new(UnauthorizedRequestError)
JWTDecodeError =
Class.new(UnauthorizedRequestError)
RequestVerificationFailedError =
Class.new(UnauthorizedRequestError)
RequestBodyVerificationFailedError =
Class.new(RequestVerificationFailedError)
RequestHeaderVerificationFailedError =
Class.new(RequestVerificationFailedError)
RequestMethodVerificationFailedError =
Class.new(RequestVerificationFailedError)
RequestPathVerificationFailedError =
Class.new(RequestVerificationFailedError)
RequestQueryVerificationFailedError =
Class.new(RequestVerificationFailedError)
MissingKeyIdError =
Class.new(UnauthorizedRequestError)
MissingAlgorithmError =
Class.new(UnauthorizedRequestError)
UnknownKeyIdError =
Class.new(UnauthorizedRequestError)
AlgorithmMismatchError =
Class.new(UnauthorizedRequestError)
VERSION =
'4.0.0'

Instance Method Summary collapse

Instance Method Details

#configure_keys(key_store_id = nil) {|KeyStore.find(key_store_id)| ... } ⇒ Object

Yields:



15
16
17
# File 'lib/jwt_signed_request.rb', line 15

def configure_keys(key_store_id = nil)
  yield KeyStore.find(key_store_id)
end

#key_store(id = nil) ⇒ Object



19
20
21
# File 'lib/jwt_signed_request.rb', line 19

def key_store(id = nil)
  KeyStore.find(id)
end

#sign(**args) ⇒ Object



23
24
25
# File 'lib/jwt_signed_request.rb', line 23

def sign(**args)
  Sign.call(**args)
end

#verify(**args) ⇒ Object



27
28
29
# File 'lib/jwt_signed_request.rb', line 27

def verify(**args)
  Verify.call(**args)
end