Skip to content

Commit 38a0ba6

Browse files
committed
Sync documentation of main branch
1 parent 4c68047 commit 38a0ba6

File tree

2 files changed

+82
-3
lines changed

2 files changed

+82
-3
lines changed

_generated-doc/main/infra/quarkus-all-build-items.adoc

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,15 @@ _No Javadoc found_
140140
a| https://github.com/quarkusio/quarkus/blob/main/core/deployment/src/main/java/io/quarkus/deployment/builditem/ApplicationInfoBuildItem.java[`io.quarkus.deployment.builditem.ApplicationInfoBuildItem`, window="_blank"]
141141
[.description]
142142
--
143-
_No Javadoc found_
143+
This build item holds essential metadata about the application, specifically its name and version. The values can be configured using the following properties:
144+
145+
* `quarkus.application.name` - Sets the application name
146+
147+
148+
* `quarkus.application.version` - Sets the application version
149+
150+
151+
This configuration is intended to be used by extensions that require application metadata, such as the kubernetes extension.
144152
-- a|`java.lang.String name`
145153
146154
_No Javadoc found_
@@ -2054,8 +2062,21 @@ a| https://github.com/quarkusio/quarkus/blob/main/core/deployment/src/main/java/
20542062
Attempts to register a complete type hierarchy for reflection.
20552063
This is intended to be used to register types that are going to be serialized, e.g. by Jackson or some other JSON mapper.
20562064
This will do 'smart discovery' and in addition to registering the type itself it will also attempt to register the following:
2057-
- Superclasses - Subclasses - Component types of collections - Types used in bean properties (if method reflection is enabled) - Field types (if field reflection is enabled)
2058-
This discovery is applied recursively, so any additional types that are registered will also have their dependencies discovered
2065+
2066+
* Superclasses
2067+
2068+
2069+
* Component types of collections
2070+
2071+
2072+
* Types used in bean properties (if method reflection is enabled)
2073+
2074+
2075+
* Field types (if field reflection is enabled)
2076+
2077+
2078+
2079+
This discovery is applied recursively, so any additional types that are registered will also have their dependencies discovered.
20592080
-- a|`org.jboss.jandex.Type type`
20602081
20612082
_No Javadoc found_

_versions/main/guides/security-oidc-code-flow-authentication.adoc

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,6 +1655,64 @@ public class ServiceResource {
16551655
<2> Revoke the authorization code flow access token.
16561656
<3> Revoke the authorization code flow refresh token.
16571657

1658+
You can also revoke tokens in the security event listeners.
1659+
1660+
For example, when your application supports a standard <<user-initiated-logout>>, you can catch a logout event and revoke tokens:
1661+
1662+
[source,java]
1663+
----
1664+
import java.util.concurrent.CompletableFuture;
1665+
import java.util.concurrent.CompletionStage;
1666+
1667+
import io.quarkus.oidc.AccessTokenCredential;
1668+
import io.quarkus.oidc.OidcProviderClient;
1669+
import io.quarkus.oidc.RefreshToken;
1670+
import io.quarkus.oidc.SecurityEvent;
1671+
import io.quarkus.security.identity.SecurityIdentity;
1672+
import io.smallrye.mutiny.Uni;
1673+
import jakarta.enterprise.context.ApplicationScoped;
1674+
import jakarta.enterprise.event.ObservesAsync;
1675+
1676+
@ApplicationScoped
1677+
public class SecurityEventListener {
1678+
1679+
public CompletionStage<Void> processSecurityEvent(@ObservesAsync SecurityEvent event) {
1680+
if (SecurityEvent.Type.OIDC_LOGOUT_RP_INITIATED == event.getEventType()) { <1>
1681+
return revokeTokens(event.getSecurityIdentity()).subscribeAsCompletionStage();
1682+
}
1683+
return CompletableFuture.completedFuture(null);
1684+
}
1685+
private Uni<Void> revokeTokens(SecurityIdentity securityIdentity) {
1686+
return Uni.join().all(
1687+
revokeAccessToken(securityIdentity),
1688+
revokeRefreshToken(securityIdentity)
1689+
).andCollectFailures()
1690+
.replaceWithVoid()
1691+
.onFailure().recoverWithUni(t -> logFailure(t));
1692+
}
1693+
1694+
private static Uni<Boolean> revokeAccessToken(SecurityIdentity securityIdentity) { <2>
1695+
OidcProviderClient oidcProvider = securityIdentity.getAttribute(OidcProviderClient.class.getName());
1696+
String accessToken = securityIdentity.getCredential(AccessTokenCredential.class).getToken();
1697+
return oidcProvider.revokeAccessToken(accessToken);
1698+
}
1699+
1700+
private static Uni<Boolean> revokeRefreshToken(SecurityIdentity securityIdentity) { <3>
1701+
OidcProviderClient oidcProvider = securityIdentity.getAttribute(OidcProviderClient.class.getName());
1702+
String refreshToken = securityIdentity.getCredential(RefreshToken.class).getToken();
1703+
return oidcProvider.revokeRefreshToken(refreshToken);
1704+
}
1705+
1706+
private static Uni<Void> logFailure(Throwable t) {
1707+
// Log failure as required
1708+
return Uni.createFrom().voidItem();
1709+
}
1710+
}
1711+
----
1712+
<1> Revoke tokens if an RP-initiated logout event is observed.
1713+
<2> Revoke the authorization code flow access token.
1714+
<3> Revoke the authorization code flow refresh token.
1715+
16581716
=== Propagating tokens to downstream services
16591717

16601718
For information about Authorization Code Flow access token propagation to downstream services, see the xref:security-openid-connect-client-reference.adoc#token-propagation-rest[Token Propagation] section.

0 commit comments

Comments
 (0)