Class: Atlassian::JiraConnect::Jwt::Asymmetric
- Inherits:
-
Object
- Object
- Atlassian::JiraConnect::Jwt::Asymmetric
- Includes:
- Gitlab::Utils::StrongMemoize
- Defined in:
- lib/atlassian/jira_connect/jwt/asymmetric.rb
Overview
See documentation about Atlassian asymmetric JWT verification: developer.atlassian.com/cloud/jira/platform/understanding-jwt-for-connect-apps/#verifying-a-asymmetric-jwt-token-for-install-callbacks
Constant Summary collapse
- KeyFetchError =
Class.new(StandardError)
- ALGORITHM =
'RS256'
- DEFAULT_PUBLIC_KEY_CDN_URL =
'https://connect-install-keys.atlassian.com'
- PROXY_PUBLIC_KEY_PATH =
'/-/jira_connect/public_keys'
- KEY_ID_REGEX =
%r{\A[A-Za-z0-9_\-\/]+\z}
Instance Method Summary collapse
-
#initialize(token, verification_claims) ⇒ Asymmetric
constructor
A new instance of Asymmetric.
- #iss_claim ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(token, verification_claims) ⇒ Asymmetric
Returns a new instance of Asymmetric.
19 20 21 22 |
# File 'lib/atlassian/jira_connect/jwt/asymmetric.rb', line 19 def initialize(token, verification_claims) @token = token @verification_claims = verification_claims end |
Instance Method Details
#iss_claim ⇒ Object
28 29 30 31 32 |
# File 'lib/atlassian/jira_connect/jwt/asymmetric.rb', line 28 def iss_claim return unless claims claims['iss'] end |
#valid? ⇒ Boolean
24 25 26 |
# File 'lib/atlassian/jira_connect/jwt/asymmetric.rb', line 24 def valid? claims.present? && claims['qsh'] == verification_qsh end |