Skip to content
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

Support for JWT-based access token #3773

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft

Conversation

wmathurin
Copy link
Contributor

Overview

Connected app / external client app can be configured to issue JWT-based access token (for more information see here).

The mobile application does not need to know if it is using a JWT-based access token or an opaque token in most cases.
Login and refresh will just work as before.

However, front door URL cannot be built directly using the JWT-based access token. Instead the single access API should be called to generate front door URL.

We already made changes in the Mobile SDK to be JWT-based access token ready:

Changes in this PR

  • We are saving the token format and parent sid returned by the token end point during login and refresh in the user account.
  • We added a class JwtAccessToken to allow apps to inspect the JWT encoded in the JWT-based access token.

Testing

  • We added tests to check that token format and parent sid are properly captured and saved.
  • We added tests for JwtAccessToken.
  • We manually verified that login/refresh works in native applications.
  • [TODO] We manually verified that the IDP-SP flows work when JWT-based access token are being used.

TODO

  • Modify SalesforceWebViewCookieManager i.e. the class responsible for hydrating the web view sessions in hybrid remote apps when JWT-based access token are in use. This change will be done in a separate PR because this class lives in a separate repo: https://github.com/forcedotcom/SalesforceMobileSDK-ios-hybrid.
  • Manually verified that login/refresh works in hybrid remote applications.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 1.96078% with 50 lines in your changes missing coverage. Please review.

Project coverage is 63.13%. Comparing base (23bc706) to head (414443f).
Report is 1 commits behind head on dev.

Files with missing lines Patch % Lines
...lesforceSDKCore/Classes/OAuth/JwtAccessToken.swift 0.00% 32 Missing ⚠️
...lesforceSDKCore/Classes/OAuth/SFOAuthCredentials.m 9.09% 10 Missing ⚠️
...SDKCore/Classes/OAuth/SFOAuthKeychainCredentials.m 0.00% 4 Missing ⚠️
...KCore/SalesforceSDKCore/Classes/Util/SFSDKOAuth2.m 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #3773      +/-   ##
==========================================
- Coverage   63.28%   63.13%   -0.16%     
==========================================
  Files         225      226       +1     
  Lines       21472    21519      +47     
==========================================
- Hits        13589    13586       -3     
- Misses       7883     7933      +50     
Components Coverage Δ
Analytics 84.09% <ø> (ø)
Common 68.96% <ø> (ø)
Core 52.36% <1.96%> (-0.22%) ⬇️
SmartStore 73.65% <ø> (ø)
MobileSync 87.64% <ø> (ø)
Files with missing lines Coverage Δ
...SDKCore/Classes/OAuth/SFOAuthKeychainCredentials.m 85.71% <0.00%> (-4.70%) ⬇️
...KCore/SalesforceSDKCore/Classes/Util/SFSDKOAuth2.m 42.67% <0.00%> (-0.54%) ⬇️
...lesforceSDKCore/Classes/OAuth/SFOAuthCredentials.m 83.59% <9.09%> (-3.56%) ⬇️
...lesforceSDKCore/Classes/OAuth/JwtAccessToken.swift 0.00% <0.00%> (ø)
---- 🚨 Try these New Features:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants