-
Notifications
You must be signed in to change notification settings - Fork 40
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
✨ Steam - Load additional claims from user information endpoint #166
base: dev
Are you sure you want to change the base?
Conversation
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.
Tests should follow the example of the existing tests for the Steam provider, where the stubbed response is amended to add the new content and then the claims and values asserted on.
|
||
|
||
|
||
return; |
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.
Redundant.
return; |
|
||
return; | ||
|
||
void AddSteamProfileClaim(string claimType) |
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.
Not a fan of the doubly-nested local method here.
{ | ||
if (profile.TryGetProperty(claimType, out var claimValue)) | ||
{ | ||
identity.AddClaim(new Claim(claimType, claimValue.GetRawText().Trim('"'), ClaimValueTypes.String, Options.ClaimsIssuer)); |
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'm not sure about this mangling of the extra properties here. We should just deal with ones that are strings and leave others to the user to manually configure.
Alternatively, parse each one appropriately from the type it is in the JSON to match whatever it's documented to be.
/// </summary> | ||
public static class SteamClaimTypes | ||
{ | ||
// Public |
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.
Redundant given the next line immediately has a public access modifier.
// Public |
public const string AvatarMedium = "avatarmedium"; | ||
public const string AvatarFull = "avatarfull"; | ||
/// <summary> | ||
/// The user's current status. 0 - Offline, 1 - Online, 2 - Busy, 3 - Away, 4 - Snooze, 5 - looking to trade, 6 - looking to play. If the player's profile is private, this will always be "0", except is the user has set their status to looking to trade or looking to play, because a bug makes those status appear even if the profile is private. |
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.
Remove the values. We don't need to parrot Steam's own documentation.
public const string LastLogOff = "lastlogoff"; | ||
public const string CommentPermission = "commentpermission"; | ||
|
||
// Private |
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.
If they're private to Steam we shouldn't be depending on them in our code. If you mean they're an implementation detail of the implementation, then they should be declared as ˋinternal`.
Summarize the changes this Pull Request makes.
Load additional claims from user information endpoint
If adding a new provider, please ensure you have included appropriate test(s).
There's a few different ways to test this, let me know how/if you want this tested.
Please include a reference to a GitHub issue if appropriate.