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

✨ Steam - Load additional claims from user information endpoint #166

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Hona
Copy link

@Hona Hona commented Nov 30, 2023

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.

image

@Hona Hona marked this pull request as ready for review November 30, 2023 02:19
Copy link
Member

@martincostello martincostello left a 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;
Copy link
Member

Choose a reason for hiding this comment

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

Redundant.

Suggested change
return;


return;

void AddSteamProfileClaim(string claimType)
Copy link
Member

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));
Copy link
Member

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
Copy link
Member

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.

Suggested change
// 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.
Copy link
Member

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
Copy link
Member

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`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants