You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "dpogue (via GitHub)" <gi...@apache.org> on 2024/12/14 09:26:13 UTC

[PR] feat(plugins): Better define plugin behaviour protocols [cordova-ios]

dpogue opened a new pull request, #1514:
URL: https://github.com/apache/cordova-ios/pull/1514

   ### Platforms affected
   iOS
   
   
   ### Motivation and Context
   <!-- Why is this change required? What problem does it solve? -->
   <!-- If it fixes an open issue, please link to the issue here. -->
   Closes GH-1212.
   Closes GH-1272.
   Closes GH-1333.
   
   
   ### Description
   <!-- Describe your changes in detail -->
   Adds protocols to formalize the methods that plugins should implement to interact with behaviour around authentication challenges and navigation decisions.
   
   For navigation decisions, we now pass along the full navigation action details as a dictionary.
   
   This also adds the ability for plugins to intercept and respond to server authentication challenges.
   
   
   ### Testing
   <!-- Please describe in detail how you tested your changes. -->
   All existing tests pass.
   
   
   ### Checklist
   
   - [x] I've run the tests to see all new and existing tests pass
   - [x] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct [keyword to close issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/))
   - [x] I've updated the documentation if necessary
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Re: [PR] feat(plugins): Better define plugin behaviour protocols [cordova-ios]

Posted by "dpogue (via GitHub)" <gi...@apache.org>.
dpogue merged PR #1514:
URL: https://github.com/apache/cordova-ios/pull/1514


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Re: [PR] feat(plugins): Better define plugin behaviour protocols [cordova-ios]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #1514:
URL: https://github.com/apache/cordova-ios/pull/1514#issuecomment-2543027773

   ## [Codecov](https://app.codecov.io/gh/apache/cordova-ios/pull/1514?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   All modified and coverable lines are covered by tests :white_check_mark:
   > Project coverage is 80.84%. Comparing base [(`9beca6d`)](https://app.codecov.io/gh/apache/cordova-ios/commit/9beca6d7d3368c157cb5f712e348860dc0aceb3e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`6dddcc9`)](https://app.codecov.io/gh/apache/cordova-ios/commit/6dddcc9995ccf3294235c69af69b3edace0e4e8b?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@           Coverage Diff           @@
   ##           master    #1514   +/-   ##
   =======================================
     Coverage   80.84%   80.84%           
   =======================================
     Files          16       16           
     Lines        1848     1848           
   =======================================
     Hits         1494     1494           
     Misses        354      354           
   ```
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/cordova-ios/pull/1514?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Re: [PR] feat(plugins): Better define plugin behaviour protocols [cordova-ios]

Posted by "dpogue (via GitHub)" <gi...@apache.org>.
dpogue commented on code in PR #1514:
URL: https://github.com/apache/cordova-ios/pull/1514#discussion_r1898317261


##########
CordovaLib/include/Cordova/CDVPlugin.h:
##########
@@ -85,6 +89,74 @@ extern const NSNotificationName CDVViewWillTransitionToSizeNotification;
 
 #pragma mark - Plugin protocols
 
+/**
+ A protocol for Cordova plugins to intercept and respond to server
+ authentication challenges through WebKit.
+
+ Your plugin should implement this protocol and the
+ ``willHandleAuthenticationChallenge:completionHandler:`` method to return
+ `YES` if it wants to support responses to server-side authentication
+ challenges, otherwise the default NSURLSession handling for authentication
+ challenges will be used.
+ */
+@protocol CDVPluginAuthenticationHandler <NSObject>
+
+/**
+ Asks your plugin to respond to an authentication challenge.
+
+ Return `YES` if the plugin is handling the challenge, and `NO` to fallback to
+ the default handling.
+
+ - Parameters:
+   - challenge: The authentication challenge.
+   - completionHandler: A completion handler block to execute with the response.
+     This handler has no return value and takes the following parameters:
+     - disposition: The option to use to handle the challenge. For a list of
+       options, see `NSURLSessionAuthChallengeDisposition`.
+     - credential: The credential to use for authentication when the
+       `disposition` parameter contains the value
+       `NSURLSessionAuthChallengeUseCredential`. Specify `nil` to continue
+       without a credential.
+ - Returns: A Boolean value indicating if the plugin is handling the request.
+ */
+- (BOOL)willHandleAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler;

Review Comment:
   @erisu Updated this to be `willHandleAuthenticationChallenge` and return a `BOOL` so that multiple plugins can have a chance to respond



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org