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

Task/p8 #6648

Open
wants to merge 13 commits into
base: alpha
Choose a base branch
from
Open

Task/p8 #6648

wants to merge 13 commits into from

Conversation

UnderratedDev
Copy link
Contributor

Added functionality to generate tokens from requesting them from Apple using a code. Uses p8 file to sign token (claims) to get real token from apple for authentication. Also uses config file for web request tokens (contains info such as redirect uri). Audience & Issuer are verified in verify function with the rest of the verification which is nicer however almost impossible to test.

@TomWFox , hope this satisfies :)

#6523

Yudhvir added 7 commits April 23, 2020 10:54
…function which is better practise and we should be using it, however we can only test with real tokens and not use the spy function call as it skips it altogether
@UnderratedDev
Copy link
Contributor Author

@TomWFox I have set placeholders for where to put config file (that we fill in from developer account panel) && also where to put the p8 file for future reference when we get an apple account. I used my own credentials to test :).

@TomWFox
Copy link
Contributor

TomWFox commented Apr 26, 2020

@UnderratedDev awesome, thanks! I haven't got around to this yet as I realised I also needed to transfer my account into my name etc. I'm also wondering whether it's sensible to use to use my personal account. I could setup a Parse Community account, do you know if its possible to generate the credentials without paying the annual fee?

@UnderratedDev
Copy link
Contributor Author

You can create a free developer account (just Apple ID), This might be helpful: Memberships
It doesn't state anything about generating service keys. Even if we did generate one, we would have to host a website to test as you cannot simply generate tokens from localhost. You need a domain for website authentication with codes, but you can generate tokens from apps (iOS, Mac, Watch OS, iPadOS). I'm wondering if it's even useful to have a p8 file at this point since you need to generate tokens from a live site so that is independent of parse unless we host a site just to generate apple codes & an app for tokens (this can be a simple project, doesn't require release & simple to setup, but you may need to setup developer account)

Also forgot to mention in description and wanted to give credit, I used this repo as a basis for requesting tokens from code: Apple Auth, I used it as a example 1 month and a bit ago (maybe 2 months). In the end, I rewrote my code entirely in my own way, but for reference, that repository contains other features which may be useful for other developers & also wanted to give credit :).

@UnderratedDev
Copy link
Contributor Author

Also, I was thinking about the way I did the config in the function, I will most likely change it so that it is passed into the options rather than as a file path. It's easier to check & then we don't have to check JSON parse errors.

@UnderratedDev
Copy link
Contributor Author

Uses config object instead of file now. No more invalid json for parse testing either. Ready to be reviewed :).

@codecov
Copy link

codecov bot commented Apr 30, 2020

Codecov Report

Merging #6648 into master will decrease coverage by 0.29%.
The diff coverage is 39.02%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6648      +/-   ##
==========================================
- Coverage   93.90%   93.61%   -0.30%     
==========================================
  Files         169      169              
  Lines       12054    12630     +576     
==========================================
+ Hits        11319    11823     +504     
- Misses        735      807      +72     
Impacted Files Coverage Δ
src/Adapters/Auth/apple.js 61.19% <39.02%> (-38.81%) ⬇️
src/Adapters/Cache/RedisCacheAdapter/index.js 65.33% <0.00%> (-29.31%) ⬇️
src/Adapters/Files/GridFSBucketAdapter.js 68.85% <0.00%> (-8.80%) ⬇️
src/Routers/FilesRouter.js 84.82% <0.00%> (-1.25%) ⬇️
src/Controllers/FilesController.js 93.61% <0.00%> (-0.39%) ⬇️
src/GraphQL/ParseGraphQLSchema.js 97.38% <0.00%> (-0.08%) ⬇️
src/middlewares.js 97.31% <0.00%> (-0.06%) ⬇️
src/rest.js 98.86% <0.00%> (ø)
src/password.js 100.00% <0.00%> (ø)
src/triggers.js 93.18% <0.00%> (ø)
... and 21 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e6a6354...6b0b3df. Read the comment docs.

@UnderratedDev
Copy link
Contributor Author

@dplewis when you have a chance, could you please take a look at this PR?

@dplewis
Copy link
Member

dplewis commented May 12, 2020

Can you provide test cases and improve coverage?

@UnderratedDev
Copy link
Contributor Author

UnderratedDev commented May 12, 2020

I did provide test cases in the Authentication spec file (p8 file, apple error, JWT errors, etc). I can take a look at increasing coverage though it shows coverage changed for files I didn't modify. I just modified the apple.js file so I will try to increase that file's coverage.

@UnderratedDev
Copy link
Contributor Author

Hey @dplewis, so I got a bit busy but recently made time to look at this again. Further test cases are hard to make since I would need to provide a p8 key, client id, etc. Also there are no test tokens provided from apple.

That being said, I will stop working on this as I don't see a way to add more in the current state. I hope this gets merged, please let me know if there is anything specific I can do to help get this merged.

@mtrezza
Copy link
Member

mtrezza commented Sep 3, 2021

⚠️ Important change for merging PRs from Parse Server 5.0 onwards!

We are planning to release the first beta version of Parse Server 5.0 in October 2021.

If a PR contains a breaking change and is not merged before the beta release of Parse Server 5.0, it cannot be merged until the end of 2022. Instead it has to follow the Deprecation Policy and phase-in breaking changes to be merged during the course of 2022.

One of the most voiced community feedbacks was the demand for predictability in breaking changes to make it easy to upgrade Parse Server. We have made a first step towards this by introducing the Deprecation Policy in February 2021 that assists to phase-in breaking changes, giving developers time to adapt. We will follow-up with the introduction of Release Automation and a branch model that will allow breaking changes only with a new major release, scheduled for the beginning of each calendar year.

We understand that some PRs are a long time in the making and we very much appreciate your contribution. We want to make it easy for PRs that contain a breaking change and were created before the introduction of the Deprecation Policy. These PRs can be merged with a breaking change without being phased-in before the beta release of Parse Server 5.0. We are making this exception because we appreciate that this is a time of transition that requires additional effort from contributors to adapt. We encourage everyone to prepare their PRs until the end of September and account for review time and possible adaptions.

If a PR contains a breaking change and should be merged before the beta release, please mention @parse-community/server-maintenance and we will coordinate with you to merge the PR.

Thanks for your contribution and support during this transition to Parse Server release automation!

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.

4 participants