Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Possibility to pass SecurityContext to HttpClient creation #71

Closed
chrbayer opened this issue Feb 5, 2019 · 7 comments
Closed

Possibility to pass SecurityContext to HttpClient creation #71

chrbayer opened this issue Feb 5, 2019 · 7 comments

Comments

@chrbayer
Copy link
Contributor

chrbayer commented Feb 5, 2019

Hi, thanks for making this lib!

To support connections to a parse server with a self-signed certificate from a mobile app, I need to pass a special created SecurityContext to the creation of the HttpClient. Are there any plans to do so?
Would it help if I prepare a PR?

Thanks in advance!

Best regards,
Chris

@phillwiggins
Copy link
Member

phillwiggins commented Feb 5, 2019 via email

@chrbayer
Copy link
Contributor Author

chrbayer commented Feb 7, 2019

I'm working on a solution, but I have one question: Is this lib compatible with dart:html or is it built just for dart:io? It would be much nicer to implement if no compatibility with dart:html has to guaranteed.

Inside parse.dart dart:io is imported...

And just another question: I used the development branch for this PR, is that Ok?

Thanks for your support!

@phillwiggins
Copy link
Member

phillwiggins commented Feb 7, 2019 via email

@chrbayer
Copy link
Contributor Author

chrbayer commented Feb 7, 2019

Hi,

that makes it a lot easier :-)

I have created a PR, can you please review? I just started to look in dart and flutter some weeks ago, so please don't hesitate to give me hints what can be made better.

Cheers,
Chris

@phillwiggins
Copy link
Member

phillwiggins commented Feb 7, 2019 via email

@chrbayer
Copy link
Contributor Author

chrbayer commented Feb 7, 2019

Hi,

No, you do not have to use a SecurityContext, it is an optional parameter to Parse().initialize(). It should be 100% backwards compatible. There is now always a SecurityContext in ParseCoreData, but this is null in case of no context has been set. In this case the old behavior without a context is used:

ParseHTTPClient([SecurityContext securityContext])
      : _client = securityContext != null
            ? IOClient(HttpClient(context: securityContext))
            : IOClient();

@phillwiggins
Copy link
Member

phillwiggins commented Feb 7, 2019 via email

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

No branches or pull requests

2 participants