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

Feature/generate user data #140

Merged
merged 5 commits into from
May 31, 2023
Merged

Feature/generate user data #140

merged 5 commits into from
May 31, 2023

Conversation

ostrya
Copy link
Collaborator

@ostrya ostrya commented May 22, 2023

Since #121 did not see any update for a long time, I decided to implement the desired feature myself.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

92.4% 92.4% Coverage
0.0% 0.0% Duplication

@ostrya ostrya requested review from christian-ertl and ripssi May 31, 2023 10:49
@@ -27,7 +27,7 @@
* <p>Example usage:
*
* <pre>{@code
* TokenConfig config = TokenConfig.aTokenConfig().withSubject("subject).build();

Choose a reason for hiding this comment

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

was this not broken?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not quite sure what you mean. If you're talking about the missing quotation mark: yes, that was broken.

@@ -56,12 +55,41 @@ public String getToken(
.claim("scope", tokenConfig.getScope())
.claim("typ", "Bearer")
.claim("azp", tokenConfig.getAuthorizedParty());
Optional<UserData> generatedUserData;

Choose a reason for hiding this comment

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

Could use ternary

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hm, yes. But it's not significantly shorter, and the google formatting looks weird:

    Optional<UserData> generatedUserData =
        tokenConfig.isGenerateUserDataFromSubject() ? Optional.of(
            UserData.fromUsernameAndHostname(
                tokenConfig.getSubject(), requestConfiguration.getHostname())) : Optional.empty();

Copy link
Contributor

@ripssi ripssi left a comment

Choose a reason for hiding this comment

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

Had to change account to submit review. See comments by space-hawk ...

@ostrya ostrya merged commit 5adb0ff into main May 31, 2023
@ostrya ostrya deleted the feature/generate-user-data branch May 31, 2023 11:15
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.

3 participants