Class: ShopifyApp::JWTMiddleware
- Inherits:
-
Object
- Object
- ShopifyApp::JWTMiddleware
- Defined in:
- lib/shopify_app/middleware/jwt_middleware.rb
Constant Summary collapse
- TOKEN_REGEX =
/^Bearer (.+)$/
- ID_TOKEN_QUERY_PARAM =
"id_token"
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ JWTMiddleware
constructor
A new instance of JWTMiddleware.
Constructor Details
#initialize(app) ⇒ JWTMiddleware
Returns a new instance of JWTMiddleware.
8 9 10 |
# File 'lib/shopify_app/middleware/jwt_middleware.rb', line 8 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/shopify_app/middleware/jwt_middleware.rb', line 12 def call(env) return call_next(env) unless ShopifyApp.configuration. token = (env) || token_from_query_string(env) return call_next(env) unless token set_env_variables(token, env) call_next(env) end |