forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get OIDC recover from the connection failure if the discovery is disa…
…bled
- Loading branch information
1 parent
3198006
commit 7f040cf
Showing
5 changed files
with
81 additions
and
6 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
28 changes: 28 additions & 0 deletions
28
...-wiremock/src/main/java/io/quarkus/it/keycloak/UsersResourceOidcRecoveredNoDiscovery.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,28 @@ | ||
package io.quarkus.it.keycloak; | ||
|
||
import javax.annotation.security.RolesAllowed; | ||
import javax.inject.Inject; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
import org.eclipse.microprofile.jwt.JsonWebToken; | ||
|
||
import io.quarkus.it.keycloak.model.User; | ||
import io.quarkus.security.identity.SecurityIdentity; | ||
|
||
@Path("/recovered-no-discovery/api/users") | ||
public class UsersResourceOidcRecoveredNoDiscovery { | ||
|
||
@Inject | ||
SecurityIdentity identity; | ||
|
||
@GET | ||
@Path("/preferredUserName") | ||
@RolesAllowed("user") | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public User preferredUserName() { | ||
return new User(((JsonWebToken) identity.getPrincipal()).getClaim("preferred_username")); | ||
} | ||
} |
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