Skip to content

Commit 6d56a73

Browse files
committed
Clarify how to augment the identity in a blocking mode
1 parent 11426e5 commit 6d56a73

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

docs/src/main/asciidoc/security-customization.adoc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,7 @@ public class RolesAugmentor implements SecurityIdentityAugmentor {
162162
163163
@Override
164164
public Uni<SecurityIdentity> augment(SecurityIdentity identity, AuthenticationRequestContext context) {
165-
return Uni.createFrom().item(build(identity));
166-
167-
// Do 'return context.runBlocking(build(identity));'
168-
// if a blocking call is required to customize the identity
165+
return Uni.createFrom().item(build(identity)); <1>
169166
}
170167
171168
private Supplier<SecurityIdentity> build(SecurityIdentity identity) {
@@ -182,6 +179,7 @@ public class RolesAugmentor implements SecurityIdentityAugmentor {
182179
}
183180
}
184181
----
182+
<1> Augment the security identity. See the <<security-augmentation-request-context>> section for an example of how to augment the identity in a blocking mode.
185183

186184
Here is another example showing how to use the client certificate available in the current xref:security-authentication-mechanisms.adoc#mutual-tls[mutual TLS (mTLS) authentication] request to add more roles:
187185

@@ -239,6 +237,9 @@ If more than one custom `SecurityIdentityAugmentor` is registered then they will
239237
You can enforce the order by implementing a default `SecurityIdentityAugmentor#priority` method. Augmentors with higher priorities will be invoked first.
240238
====
241239

240+
[[security-augmentation-request-context]]
241+
=== Activate Request Context
242+
242243
By default, the request context is not activated when augmenting the security identity, this means that if you want to use for example Hibernate
243244
that mandates a request context, you will have a `jakarta.enterprise.context.ContextNotActiveException`.
244245

0 commit comments

Comments
 (0)