-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve Sec. Identity in RESTEasy Reactive when Proactive Auth disabled
f ix #23547 for RESTEasy Reactive cases (e.g. the issue reproducer)
- Loading branch information
1 parent
f150b14
commit 551edd2
Showing
7 changed files
with
93 additions
and
7 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
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 |
---|---|---|
|
@@ -2,10 +2,13 @@ | |
|
||
import javax.annotation.security.PermitAll; | ||
import javax.annotation.security.RolesAllowed; | ||
import javax.inject.Inject; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
|
||
import io.quarkus.security.identity.CurrentIdentityAssociation; | ||
import io.smallrye.common.annotation.Blocking; | ||
import io.smallrye.common.annotation.NonBlocking; | ||
|
||
/** | ||
* @author Michal Szynkiewicz, [email protected] | ||
|
@@ -14,6 +17,10 @@ | |
@PermitAll | ||
@Blocking | ||
public class RolesAllowedBlockingResource { | ||
|
||
@Inject | ||
CurrentIdentityAssociation currentIdentityAssociation; | ||
|
||
@GET | ||
@RolesAllowed({ "user", "admin" }) | ||
public String defaultSecurity() { | ||
|
@@ -27,4 +34,12 @@ public String admin() { | |
return "admin"; | ||
} | ||
|
||
@NonBlocking | ||
@Path("/admin/security-identity") | ||
@RolesAllowed("admin") | ||
@GET | ||
public String getSecurityIdentity() { | ||
return currentIdentityAssociation.getIdentity().getPrincipal().getName(); | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -2,15 +2,23 @@ | |
|
||
import javax.annotation.security.PermitAll; | ||
import javax.annotation.security.RolesAllowed; | ||
import javax.inject.Inject; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
|
||
import io.quarkus.security.identity.CurrentIdentityAssociation; | ||
import io.smallrye.common.annotation.NonBlocking; | ||
|
||
/** | ||
* @author Michal Szynkiewicz, [email protected] | ||
*/ | ||
@Path("/roles") | ||
@PermitAll | ||
public class RolesAllowedResource { | ||
|
||
@Inject | ||
CurrentIdentityAssociation currentIdentityAssociation; | ||
|
||
@GET | ||
@RolesAllowed({ "user", "admin" }) | ||
public String defaultSecurity() { | ||
|
@@ -24,4 +32,12 @@ public String admin() { | |
return "admin"; | ||
} | ||
|
||
@NonBlocking | ||
@Path("/admin/security-identity") | ||
@RolesAllowed("admin") | ||
@GET | ||
public String getSecurityIdentity() { | ||
return currentIdentityAssociation.getIdentity().getPrincipal().getName(); | ||
} | ||
|
||
} |
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
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