-
Notifications
You must be signed in to change notification settings - Fork 482
Make sub and sid jwt claims optional #1369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
4bc8538
190fc74
a14a221
a84c930
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,12 +30,12 @@ def initialize(token) | |
| @iss = T.let(payload_hash["iss"], String) | ||
| @dest = T.let(payload_hash["dest"], String) | ||
| @aud = T.let(payload_hash["aud"], String) | ||
| @sub = T.let(payload_hash["sub"], String) | ||
| @sub = T.let(payload_hash["sub"], T.nilable(String)) | ||
| @exp = T.let(payload_hash["exp"], Integer) | ||
| @nbf = T.let(payload_hash["nbf"], Integer) | ||
| @iat = T.let(payload_hash["iat"], Integer) | ||
| @jti = T.let(payload_hash["jti"], String) | ||
| @sid = T.let(payload_hash["sid"], String) | ||
| @sid = T.let(payload_hash["sid"], T.nilable(String)) | ||
|
|
||
| raise ShopifyAPI::Errors::InvalidJwtTokenError, | ||
| "Session token had invalid API key" unless @aud == Context.api_key | ||
|
|
@@ -47,19 +47,11 @@ def shop | |
| end | ||
| alias_method :shopify_domain, :shop | ||
|
|
||
| sig { returns(Integer) } | ||
| sig { returns(T.nilable(Integer)) } | ||
| def shopify_user_id | ||
| @sub.to_i | ||
| end | ||
| return unless @sub | ||
|
|
||
| # TODO: Remove before releasing v11 | ||
| sig { params(shop: String).returns(T::Boolean) } | ||
| def validate_shop(shop) | ||
| Context.logger.warn( | ||
| "Deprecation notice: ShopifyAPI::Auth::JwtPayload.validate_shop no longer checks the given shop and always " \ | ||
| "returns true. It will be removed in v11.", | ||
| ) | ||
| true | ||
| @sub.tr("^0-9", "").to_i | ||
| end | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How can this work? If the @lizkenyon I think this is the answer to your question here: https://github.com/Shopify/shopify-api-ruby/pull/1346/files#r1831667330 |
||
|
|
||
| alias_method :eql?, :== | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.