From d98d0e7d6ef3d66a6d001ee9e580d2712d0ffb8d Mon Sep 17 00:00:00 2001 From: danielmast Date: Mon, 20 Dec 2021 13:50:19 +0100 Subject: [PATCH] Return claim names for JWT test security --- .../jwt/JwtTestSecurityIdentityAugmentorProducer.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test-framework/security-jwt/src/main/java/io/quarkus/test/security/jwt/JwtTestSecurityIdentityAugmentorProducer.java b/test-framework/security-jwt/src/main/java/io/quarkus/test/security/jwt/JwtTestSecurityIdentityAugmentorProducer.java index ef91b90b9e229..2685c86ca5b56 100644 --- a/test-framework/security-jwt/src/main/java/io/quarkus/test/security/jwt/JwtTestSecurityIdentityAugmentorProducer.java +++ b/test-framework/security-jwt/src/main/java/io/quarkus/test/security/jwt/JwtTestSecurityIdentityAugmentorProducer.java @@ -1,7 +1,10 @@ package io.quarkus.test.security.jwt; import java.lang.annotation.Annotation; +import java.util.Arrays; +import java.util.Collections; import java.util.Set; +import java.util.stream.Collectors; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Produces; @@ -55,7 +58,10 @@ public T getClaim(String claimName) { @Override public Set getClaimNames() { - return null; + if (jwtSecurity != null && jwtSecurity.claims() != null) { + return Arrays.stream(jwtSecurity.claims()).map(Claim::key).collect(Collectors.toSet()); + } + return Collections.emptySet(); } });