Skip to content
This repository has been archived by the owner on Dec 3, 2024. It is now read-only.

Commit

Permalink
Added firstname and lastname in auth details
Browse files Browse the repository at this point in the history
  • Loading branch information
unistudents-bot authored and donfn committed Oct 25, 2023
1 parent bbf6974 commit 7243020
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 25 deletions.
28 changes: 5 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,9 @@ jobs:
uses: qcastel/github-actions-maven-cmd@master
with:
maven-args: "clean install -Dmaven.test.skip=true -Ddockerfile.skip -DdockerCompose.skip -Djib.skip"

- name: Release
uses: qcastel/github-actions-maven-release@master
- run: mvn --batch-mode --update-snapshots verify
- run: mkdir staging && cp target/*.jar staging
- uses: actions/upload-artifact@v3
with:
release-branch-name: "main"
version-minor: true

git-release-bot-name: "phasetwo-bot"
git-release-bot-email: "[email protected]"

maven-args: "-B -Dmaven.test.skip=true -DskipITs -Dmaven.deploy.skip=true"

ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

gpg-enabled: true
gpg-key-id: BC6B4EADEB514AFD
gpg-key: ${{ secrets.GPG_KEY }}

docker-registry-id: ossrh
docker-registry-username: ${{ secrets.OSSRH_USERNAME }}
docker-registry-password: ${{ secrets.OSSRH_PASSWORD }}

maven-development-version-number: ${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion}-SNAPSHOT
maven-release-version-number: ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}
name: Package
path: staging
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ NOTES
.factorypath
.project
.settings/

.idea/
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<main.java.package>io.phasetwo.keycloak.events</main.java.package>
<junit.version>4.13.2</junit.version>
<keycloak.version>22.0.4</keycloak.version>
<keycloak.version>22.0.1</keycloak.version>
<lombok.version>1.18.30</lombok.version>
<auto-service.version>1.1.1</auto-service.version>
<ossrh.url>https://s01.oss.sonatype.org</ossrh.url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ public class ExtendedAuthDetails extends AuthDetails {
private String username;
private String sessionId;

private String firstName;

private String lastName;

public ExtendedAuthDetails(AuthDetails authDetails) {
if (authDetails != null) {
setClientId(authDetails.getClientId());
Expand All @@ -32,4 +36,21 @@ public void setSessionId(String sessionId) {
public String getSessionId() {
return sessionId;
}

public void setFirstName(String firstName) {
this.firstName = firstName;
}

public String getFirstName() {
return firstName;
}

public void setLastName(String lastName) {
this.lastName = lastName;
}

public String getLastName() {
return lastName;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import io.phasetwo.keycloak.representation.ExtendedAdminEvent;
import io.phasetwo.keycloak.representation.ExtendedAuthDetails;
import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import jakarta.ws.rs.*;
import jakarta.ws.rs.BadRequestException;
import jakarta.ws.rs.ClientErrorException;
Expand Down Expand Up @@ -61,6 +60,9 @@ private ExtendedAuthDetails getAuthDetails() {
details.setClientId(auth.getClient().getClientId());
details.setUserId(auth.getUser().getId());
details.setUsername(auth.getUser().getUsername());
details.setFirstName(auth.getUser().getFirstName());
details.setLastName(auth.getUser().getLastName());

optionalOf(() -> session.getContext().getConnection().getRemoteAddr())
.ifPresent(details::setIpAddress);
optionalOf(() -> session.getContext().getAuthenticationSession().getParentSession().getId())
Expand Down

0 comments on commit 7243020

Please sign in to comment.