-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fire OIDC event when server not available
- Loading branch information
1 parent
ace2bbd
commit 39a0e35
Showing
5 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/OidcEventObserver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.quarkus.it.keycloak; | ||
|
||
import jakarta.enterprise.event.Observes; | ||
import jakarta.inject.Singleton; | ||
|
||
import io.quarkus.oidc.SecurityEvent; | ||
|
||
@Singleton | ||
public class OidcEventObserver { | ||
|
||
private volatile boolean oidcServerNotAvailable = false; | ||
|
||
void observe(@Observes SecurityEvent event) { | ||
if (event.getEventType() == SecurityEvent.Type.OIDC_SERVER_NOT_AVAILABLE) { | ||
oidcServerNotAvailable = true; | ||
} | ||
} | ||
|
||
boolean isOidcServerNotAvailable() { | ||
return oidcServerNotAvailable; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/OidcEventResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.quarkus.it.keycloak; | ||
|
||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
|
||
@Path("/oidc-event") | ||
public class OidcEventResource { | ||
|
||
private final OidcEventObserver oidcEventObserver; | ||
|
||
public OidcEventResource(OidcEventObserver oidcEventObserver) { | ||
this.oidcEventObserver = oidcEventObserver; | ||
} | ||
|
||
@GET | ||
public boolean oidcServerUnavailable() { | ||
return oidcEventObserver.isOidcServerNotAvailable(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters