Skip to content

Commit

Permalink
Fix username checking
Browse files Browse the repository at this point in the history
  • Loading branch information
pvannierop committed Jun 4, 2024
1 parent e7e065c commit bdfab6e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ObservationResource(
@PathParam("topicId") topicId: String,
): ObservationListDto {
if (request.securityContext != null && request.securityContext is RadarSecurityContext) {
val userName = (request.securityContext as RadarSecurityContext).userPrincipal
val userName = (request.securityContext as RadarSecurityContext).auth.token.username
log.info("User $userName is accessing observations for $subjectId")
if (!subjectId.equals(userName)) throw NotFoundException("Subjects can only request their own observations.")
return observationService.getObservations(projectId = projectId, subjectId = subjectId, topicId = topicId)
Expand Down

0 comments on commit bdfab6e

Please sign in to comment.