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 authentication tokens #39

Closed
shigmas opened this issue Apr 23, 2017 · 3 comments
Closed

Support for JWT authentication tokens #39

shigmas opened this issue Apr 23, 2017 · 3 comments

Comments

@shigmas
Copy link
Contributor

shigmas commented Apr 23, 2017

This would make supporting multiple applications easier.

If it's alright, I'd like to add this. I don't know if it's overarchitecting, but I was thinking of replacing the cert_file parameter in APNsClient's init with a new Credentials class instance. There would be two subclasses: the CertificateCredentials and TokenCredentials. (Since tokens are meant to be reused (currently, for up to an hour), clients could come and go, as long as someone is holding on to the credentials instance.) Both classes would implement get_connection and get_authentication_header methods.

We could keep the old API too, and create the credential class if that parameter is a string:

def __init__(self, credentials, use_sandbox=False,...
...
    if isinstance(credentials, str):
      self.__credentials = CertificateCredentials(credentials)
   else:
      self.__credentials = credentials
@shigmas
Copy link
Contributor Author

shigmas commented May 3, 2017

Am I off base? Is this a useless thing to support?

@Pr0Ger
Copy link
Owner

Pr0Ger commented May 3, 2017

No, it's not. I had plans for adding support for tokens authentication but did not find some time for it. Thanks for your contribution, it's merged in ae835a1

@Pr0Ger Pr0Ger closed this as completed May 3, 2017
@shigmas
Copy link
Contributor Author

shigmas commented May 3, 2017

Cool. Thanks!

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

No branches or pull requests

2 participants