Module: Warden::JWTAuth
- Extended by:
- Dry::Configurable
- Defined in:
- lib/warden/jwt_auth.rb,
lib/warden/jwt_auth/hooks.rb,
lib/warden/jwt_auth/errors.rb,
lib/warden/jwt_auth/version.rb,
lib/warden/jwt_auth/strategy.rb,
lib/warden/jwt_auth/env_helper.rb,
lib/warden/jwt_auth/interfaces.rb,
lib/warden/jwt_auth/middleware.rb,
lib/warden/jwt_auth/user_decoder.rb,
lib/warden/jwt_auth/user_encoder.rb,
lib/warden/jwt_auth/header_parser.rb,
lib/warden/jwt_auth/token_decoder.rb,
lib/warden/jwt_auth/token_encoder.rb,
lib/warden/jwt_auth/token_revoker.rb,
lib/warden/jwt_auth/payload_user_helper.rb,
lib/warden/jwt_auth/middleware/token_dispatcher.rb,
lib/warden/jwt_auth/middleware/revocation_manager.rb
Overview
JWT authentication plugin for warden.
It consists of a strategy which tries to authenticate an user decoding a token present in the ‘Authentication` header (as `Bearer %token%`). From it, it takes the `sub` claim and provides it to a configured repository of users for the current scope.
It also consists of two rack middlewares which perform two actions for configured request paths: dispatching a token for a signed in user and revoking an incoming token.
Defined Under Namespace
Modules: EnvHelper, Errors, HeaderParser, Interfaces, PayloadUserHelper Classes: Hooks, Middleware, Strategy, TokenDecoder, TokenEncoder, TokenRevoker, UserDecoder, UserEncoder
Constant Summary collapse
- Import =
Dry::AutoInject(config)
- VERSION =
'0.10.0'
Class Method Summary collapse
- .constantize_values(hash) ⇒ Object
- .symbolize_keys(hash) ⇒ Object
- .upcase_first_items(array) ⇒ Object
Class Method Details
.constantize_values(hash) ⇒ Object
33 34 35 36 37 |
# File 'lib/warden/jwt_auth.rb', line 33 def constantize_values(hash) hash.transform_values do |value| value.is_a?(String) ? Object.const_get(value) : value end end |
.symbolize_keys(hash) ⇒ Object
22 23 24 |
# File 'lib/warden/jwt_auth.rb', line 22 def symbolize_keys(hash) hash.transform_keys(&:to_sym) end |
.upcase_first_items(array) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/warden/jwt_auth.rb', line 26 def upcase_first_items(array) array.map do |tuple| method, path = tuple [method.to_s.upcase, path] end end |