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

[wkwebview] create api to allow clients to present a client credential for authentication #141

Merged
merged 7 commits into from
Feb 12, 2019

Conversation

jsonblob
Copy link
Contributor

In order for TLS Mutual Auth to work for webviews, the caller must present a credential. Expose a setter that can be called to set a credential.

…esent a credential. Expose a setter that can be called to set a credential.
@jamonholmgren
Copy link
Member

Thanks for the PR @mjhu !

  • Is this only applicable to iOS, not Android?
  • Can you update the ./docs with the new setter?
  • What's a good way for us to test if this works on our machines?

@jamonholmgren jamonholmgren added the User: question Further information is requested label Nov 18, 2018
@Titozzz
Copy link
Collaborator

Titozzz commented Nov 21, 2018

FYI: facebook/react-native@8911353 This has been merged into the core. But i'd still like that we wait for the answers to above questions :)

@jsonblob
Copy link
Contributor Author

Thanks for the comments @jamonholmgren and @Titozzz!

  • This is only applicable to iOS for now.
  • Will update the docs with the new setter
  • Our use case is that we pass in a string label for the identity that we stored. We have another RN module that takes a string label and calls the RCTWKWebView static method to store the fetched credential object. Finally, any opened webviews that requires the client credential will pass auth checks .

@jsonblob
Copy link
Contributor Author

@jamonholmgren and @Titozzz sorry for the delay! I updated the docs for usage of the new setter.

If you open webpages that needs a Client Certificate for Authentication, you can create a credential and pass it to the webview:

```
[RNCWKWebView setClientAuthenticationCredential:credential];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mjhu Can you explain where you would put this code, normally? Would it be in the AppDelegate.m file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't have to be in AppDelegate.m. For our use case, we have this call inside our auth initiation stack that runs as part of app start. The only requirement is that call is made before using any webviews. I'll update the comment with this.

@jamonholmgren jamonholmgren added Maintainer: need testing Code looks good, can someone help us and test this ? and removed User: question Further information is requested labels Dec 29, 2018
@jsonblob
Copy link
Contributor Author

jsonblob commented Jan 9, 2019

@jamonholmgren Regarding testing, this was done on an internal app and I verified the webview presents the client cert correctly and is able to access the test site.

@Titozzz
Copy link
Collaborator

Titozzz commented Feb 12, 2019

As this landed on the core webview, I'll merge it here too.

@Titozzz Titozzz merged commit fc5fd24 into react-native-webview:master Feb 12, 2019
react-native-community-bot pushed a commit that referenced this pull request Feb 12, 2019
# [5.1.0](v5.0.8...v5.1.0) (2019-02-12)

### Features

* **wkwebview:** create api to allow clients to present a client credential for authentication ([#141](#141)) ([fc5fd24](fc5fd24))
@react-native-community-bot
Copy link
Collaborator

🎉 This PR is included in version 5.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

phuongwd pushed a commit to phuongwd/react-native-webview that referenced this pull request Apr 29, 2020
…ential for authentication (react-native-webview#141)

* In order for TLS Mutual Auth to work for webviews, the caller must present a credential. Expose a setter that can be called to set a credential.
phuongwd pushed a commit to phuongwd/react-native-webview that referenced this pull request Apr 29, 2020
# [5.1.0](react-native-webview/react-native-webview@v5.0.8...v5.1.0) (2019-02-12)

### Features

* **wkwebview:** create api to allow clients to present a client credential for authentication ([react-native-webview#141](react-native-webview#141)) ([fc5fd24](react-native-webview@fc5fd24))
@jaulz
Copy link

jaulz commented Jun 6, 2021

@mjhu do you have some code examples by any chance how you use it? 😊

noproblem23 added a commit to noproblem23/react-native-webview that referenced this pull request Apr 18, 2023
# [5.1.0](react-native-webview/react-native-webview@v5.0.8...v5.1.0) (2019-02-12)

### Features

* **wkwebview:** create api to allow clients to present a client credential for authentication ([#141](react-native-webview/react-native-webview#141)) ([fc5fd24](react-native-webview/react-native-webview@fc5fd24))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintainer: need testing Code looks good, can someone help us and test this ?
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants