feat: Added OIDC-compliant picture attribute mapping + JUnit 6 Tests + Bugfix#64
Open
kevin-paul00 wants to merge 4 commits into
Open
feat: Added OIDC-compliant picture attribute mapping + JUnit 6 Tests + Bugfix#64kevin-paul00 wants to merge 4 commits into
kevin-paul00 wants to merge 4 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request - OIDC-compliant Picture Attribute Mapping
This PR implements the OIDC-compliant claim
picture, introduces unit tests, and fixes a bug related to providing allowed guilds.pictureClaimDiscord provides a claim
avatarthat contains a hash of the user's profile picture. To access the link, it needs to be stitched together to a link of the formhttps://cdn.discordapp.com/avatars/<User ID>/<Hash>.<Datatype>?size=<Size>.I have saved it in a new claim named
picture, adhering to the OpenID Connect Standard. This enables services to access the profile picture in a standardized way without requiring Discord-specific logic.Regarding the image size, Discord provides an image with the size
128by default, which is a very low resolution. For now, I have hardcoded the size of256. A future contributor could extend this project by implementing a configuration for a desired image size.https://discord.com/developers/docs/reference#image-formatting
JUnit 6 Unit Tests + Mockito
To ensure the testability of the features, I have introduced unit tests using the latest JUnit 6 version. Mockito is used to mock certain objects that shall not be the subject of tests for now. (
DiscordIdentityProviderTest.javamakes use of it, for instance.)I have written basic test cases for the project that may be extended in the future.
Bugfix: Allowed Guilds
It was possible to provide an invalidly formatted string (e.g., with trailing commas or spaces) that led to behavioral errors. I fixed it by sanitizing the input before saving the
allowedGuildsstring.