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

Adopt provider metadata issuer from discovery document when doing token verification #86

Merged
merged 2 commits into from
Jul 29, 2019

Conversation

eJamesLin
Copy link
Contributor

About

@eJamesLin eJamesLin requested a review from onevcat July 29, 2019 05:36
@@ -288,7 +290,7 @@ extension LoginManager {
func getJWK(
Copy link
Member

Choose a reason for hiding this comment

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

Let's rename this method to something like getProviderMetadata

Copy link
Contributor Author

Choose a reason for hiding this comment

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

indeed. got it~ thanks~

@@ -334,12 +336,12 @@ extension LoginManager {
}
}

func verifyIDToken(_ token: JWT, key: JWK, process: LoginProcess, userID: String?) throws {
func verifyIDToken(_ token: JWT, expected: DiscoveryDocument.ResolvedProviderMetadata, process: LoginProcess, userID: String?) throws {
Copy link
Member

Choose a reason for hiding this comment

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

I prefer some new line to make the code not extending too much. Can you set the "Page Guide" at column 120?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh, thanks for the remind. My previous page guide seems gone after switching between Xcode 10/11 😂

@@ -187,7 +187,9 @@ public class LoginManager {
let group = DispatchGroup()

var profile: UserProfile?
var webToken: JWK?

var expected: DiscoveryDocument.ResolvedProviderMetadata?
Copy link
Member

Choose a reason for hiding this comment

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

I suggest providerMetadata a better name. The issuer is the expected value, but the JWK is not what is expected, it is just a key to be used while verification.

@eJamesLin eJamesLin force-pushed the Adopt-OpenID-discovery-document-in-token-verification branch from f16acde to 247258a Compare July 29, 2019 06:12
@eJamesLin eJamesLin force-pushed the Adopt-OpenID-discovery-document-in-token-verification branch from 247258a to 0d6389a Compare July 29, 2019 06:15
@onevcat
Copy link
Member

onevcat commented Jul 29, 2019

It's nice!

@onevcat onevcat merged commit 87c9b65 into master Jul 29, 2019
@eJamesLin eJamesLin deleted the Adopt-OpenID-discovery-document-in-token-verification branch July 29, 2019 06:23
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.

2 participants