Skip to content

Commit

Permalink
current user request
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetancollaud committed Feb 8, 2024
1 parent 62b257a commit 03e1d4a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package io.spoud.kcc.aggregator.graphql;

import io.quarkus.security.Authenticated;
import io.quarkus.security.identity.SecurityIdentity;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import lombok.RequiredArgsConstructor;
import org.eclipse.microprofile.graphql.GraphQLApi;
import org.eclipse.microprofile.graphql.NonNull;
import org.eclipse.microprofile.graphql.Query;

@GraphQLApi
@RequiredArgsConstructor
@Authenticated
@RequestScoped
public class UserResource {

@Inject
SecurityIdentity securityIdentity;


@Query("currentUser")
public @NonNull String currentUser() {
return securityIdentity.getPrincipal().getName();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@

@RegisterForReflection
public record ContextDataSaveRequest(
String id, Instant validFrom, Instant validUntil, @NonNull EntityType entityType, @NonNull String regex, @NonNull Map<@NonNull String, @NonNull String> context) {
String id,
Instant validFrom,
Instant validUntil,
@NonNull EntityType entityType,
@NonNull String regex,
@NonNull Map<@NonNull String, @NonNull String> context) {
public ContextData toAvro() {
return new ContextData(Instant.now(), validFrom, validUntil, entityType, regex, context);
}
Expand Down

0 comments on commit 03e1d4a

Please sign in to comment.