-
Notifications
You must be signed in to change notification settings - Fork 232
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
Added OIDC Conformant UserInfo class and API Method #122
Conversation
I need to add tests, just wanted to open up any further discussion. |
Auth0/UserInfo.swift
Outdated
updatedAt = date(from: dateString) | ||
} | ||
|
||
let keys = Set(["sub", "name", "given_name", "family_name", "middle_name", "nickname", "preferred_username", "profile", "picture", "website", "email", "email_verified", "gender", "birthdate", "zoneinfo", "locale", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And if we do
let publicClaims = ["sub", "name", "given_name", "family_name", "middle_name", "nickname", "preferred_username", "profile", "picture", "website", "email", "email_verified", "gender", "birthdate", "zoneinfo", "locale","phone_number", "phone_number_verified", "address", "updated_at"] // This can even be a static thing outside of the class since it won't change
let customClaims = json.filter { !publicClaims.contains($0.0) }
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree publicClaims
should be static.
The issue with filter
here is it will return an array of tuples, so it's not quite as elegant as this one liner suggests.
In Swift 4 this works as a filtered dictionary will now return a dictionary. (As it should really)
0946448
to
b326c74
Compare
Auth0/Authentication.swift
Outdated
- returns: a request that will yield user information | ||
- important: This method should be used for OIDC Conformant clients. | ||
*/ | ||
func userClaimInfo(token: String) -> Request<UserInfo, AuthenticationError> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try to keep the userInfo
name
Auth0/Profile.swift
Outdated
@@ -103,7 +103,7 @@ public class Profile: NSObject, JSONObjectPayload { | |||
|
|||
} | |||
|
|||
private func date(from string: String) -> Date? { | |||
func date(from string: String) -> Date? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try moving this to other file since its shared
cf653b9
to
42d12b3
Compare
Public API Added (Open to name changes)
func userClaimInfo(token: String) -> Request<UserInfo, AuthenticationError>
public class UserInfo: NSObject, JSONObjectPayload
This adheres to the standard claims specification, although we may not support all claims. I feel we should support all properties for developer convenience. For example Facebook
openid profile
will return.