diff --git a/extensions/elytron-security/runtime/src/main/java/io/quarkus/elytron/security/runtime/ElytronPasswordIdentityProvider.java b/extensions/elytron-security/runtime/src/main/java/io/quarkus/elytron/security/runtime/ElytronPasswordIdentityProvider.java index 5118f6b612034..2c624dfcda946 100644 --- a/extensions/elytron-security/runtime/src/main/java/io/quarkus/elytron/security/runtime/ElytronPasswordIdentityProvider.java +++ b/extensions/elytron-security/runtime/src/main/java/io/quarkus/elytron/security/runtime/ElytronPasswordIdentityProvider.java @@ -1,5 +1,6 @@ package io.quarkus.elytron.security.runtime; +import java.util.Collection; import java.util.function.Supplier; import jakarta.enterprise.context.ApplicationScoped; @@ -8,6 +9,7 @@ import org.jboss.logging.Logger; import org.wildfly.security.auth.server.RealmUnavailableException; import org.wildfly.security.auth.server.SecurityDomain; +import org.wildfly.security.authz.Attributes; import org.wildfly.security.evidence.PasswordGuessEvidence; import io.quarkus.security.AuthenticationFailedException; @@ -56,6 +58,10 @@ public SecurityIdentity get() { for (String i : result.getRoles()) { builder.addRole(i); } + Collection entries = result.getAttributes().entries(); + for (Attributes.Entry entry : entries) { + builder.addAttribute(entry.getKey(), entry); + } builder.addCredential(request.getPassword()); return builder.build(); } catch (RealmUnavailableException e) { diff --git a/extensions/elytron-security/runtime/src/main/java/io/quarkus/elytron/security/runtime/ElytronTokenIdentityProvider.java b/extensions/elytron-security/runtime/src/main/java/io/quarkus/elytron/security/runtime/ElytronTokenIdentityProvider.java index 9c913152b2a89..4ba3e6b26ef50 100644 --- a/extensions/elytron-security/runtime/src/main/java/io/quarkus/elytron/security/runtime/ElytronTokenIdentityProvider.java +++ b/extensions/elytron-security/runtime/src/main/java/io/quarkus/elytron/security/runtime/ElytronTokenIdentityProvider.java @@ -1,5 +1,6 @@ package io.quarkus.elytron.security.runtime; +import java.util.Collection; import java.util.function.Supplier; import jakarta.enterprise.context.ApplicationScoped; @@ -8,6 +9,7 @@ import org.jboss.logging.Logger; import org.wildfly.security.auth.server.RealmUnavailableException; import org.wildfly.security.auth.server.SecurityDomain; +import org.wildfly.security.authz.Attributes; import org.wildfly.security.evidence.BearerTokenEvidence; import io.quarkus.security.AuthenticationFailedException; @@ -55,6 +57,10 @@ public SecurityIdentity get() { for (String i : result.getRoles()) { builder.addRole(i); } + Collection entries = result.getAttributes().entries(); + for (Attributes.Entry entry : entries) { + builder.addAttribute(entry.getKey(), entry); + } builder.addCredential(request.getToken()); return builder.build(); } catch (RealmUnavailableException e) { diff --git a/extensions/elytron-security/runtime/src/main/java/io/quarkus/elytron/security/runtime/ElytronTrustedIdentityProvider.java b/extensions/elytron-security/runtime/src/main/java/io/quarkus/elytron/security/runtime/ElytronTrustedIdentityProvider.java index 314d2492e2785..743d69ac3a639 100644 --- a/extensions/elytron-security/runtime/src/main/java/io/quarkus/elytron/security/runtime/ElytronTrustedIdentityProvider.java +++ b/extensions/elytron-security/runtime/src/main/java/io/quarkus/elytron/security/runtime/ElytronTrustedIdentityProvider.java @@ -1,5 +1,6 @@ package io.quarkus.elytron.security.runtime; +import java.util.Collection; import java.util.function.Supplier; import jakarta.enterprise.context.ApplicationScoped; @@ -10,6 +11,7 @@ import org.wildfly.security.auth.server.RealmUnavailableException; import org.wildfly.security.auth.server.SecurityDomain; import org.wildfly.security.auth.server.ServerAuthenticationContext; +import org.wildfly.security.authz.Attributes; import org.wildfly.security.credential.PasswordCredential; import io.quarkus.security.AuthenticationFailedException; @@ -66,6 +68,10 @@ public SecurityIdentity get() { for (String i : result.getRoles()) { builder.addRole(i); } + Collection entries = result.getAttributes().entries(); + for (Attributes.Entry entry : entries) { + builder.addAttribute(entry.getKey(), entry); + } return builder.build(); } } catch (RealmUnavailableException e) {