-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39564 from michalvavrik/feature/secure-field-on-a…
…bstract-class-quarkus-rest Fix Quarkus REST Jackson @SecureField detection on subclasses, interface implementors, fileds of the fields, parametrized types and arrays
- Loading branch information
Showing
14 changed files
with
601 additions
and
17 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
17 changes: 17 additions & 0 deletions
17
.../src/test/java/io/quarkus/resteasy/reactive/jackson/deployment/test/AbstractNamedPet.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,17 @@ | ||
package io.quarkus.resteasy.reactive.jackson.deployment.test; | ||
|
||
import io.quarkus.resteasy.reactive.jackson.SecureField; | ||
|
||
public abstract class AbstractNamedPet extends AbstractPet { | ||
|
||
@SecureField(rolesAllowed = "admin") | ||
private String privateName; | ||
|
||
public String getPrivateName() { | ||
return privateName; | ||
} | ||
|
||
public void setPrivateName(String privateName) { | ||
this.privateName = privateName; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...yment/src/test/java/io/quarkus/resteasy/reactive/jackson/deployment/test/AbstractPet.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,23 @@ | ||
package io.quarkus.resteasy.reactive.jackson.deployment.test; | ||
|
||
public abstract class AbstractPet implements SecuredPersonInterface { | ||
|
||
private String publicName; | ||
private Veterinarian veterinarian; | ||
|
||
public String getPublicName() { | ||
return publicName; | ||
} | ||
|
||
public void setPublicName(String publicName) { | ||
this.publicName = publicName; | ||
} | ||
|
||
public Veterinarian getVeterinarian() { | ||
return veterinarian; | ||
} | ||
|
||
public void setVeterinarian(Veterinarian veterinarian) { | ||
this.veterinarian = veterinarian; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
.../test/java/io/quarkus/resteasy/reactive/jackson/deployment/test/AbstractUnsecuredPet.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,15 @@ | ||
package io.quarkus.resteasy.reactive.jackson.deployment.test; | ||
|
||
public abstract class AbstractUnsecuredPet { | ||
|
||
private String publicName; | ||
|
||
public String getPublicName() { | ||
return publicName; | ||
} | ||
|
||
public void setPublicName(String publicName) { | ||
this.publicName = publicName; | ||
} | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
...on/deployment/src/test/java/io/quarkus/resteasy/reactive/jackson/deployment/test/Cat.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,17 @@ | ||
package io.quarkus.resteasy.reactive.jackson.deployment.test; | ||
|
||
import io.quarkus.resteasy.reactive.jackson.SecureField; | ||
|
||
public class Cat extends AbstractNamedPet { | ||
|
||
@SecureField(rolesAllowed = "admin") | ||
private int privateAge; | ||
|
||
public int getPrivateAge() { | ||
return privateAge; | ||
} | ||
|
||
public void setPrivateAge(int privateAge) { | ||
this.privateAge = privateAge; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...on/deployment/src/test/java/io/quarkus/resteasy/reactive/jackson/deployment/test/Dog.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,14 @@ | ||
package io.quarkus.resteasy.reactive.jackson.deployment.test; | ||
|
||
public class Dog extends AbstractNamedPet { | ||
|
||
private int publicAge; | ||
|
||
public int getPublicAge() { | ||
return publicAge; | ||
} | ||
|
||
public void setPublicAge(int publicAge) { | ||
this.publicAge = publicAge; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...n/deployment/src/test/java/io/quarkus/resteasy/reactive/jackson/deployment/test/Frog.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.resteasy.reactive.jackson.deployment.test; | ||
|
||
import java.util.List; | ||
|
||
public class Frog { | ||
|
||
// check no cycle when field has the same type as the class which declares it | ||
private Frog partner; | ||
|
||
private List<Pond> ponds; | ||
|
||
public Frog getPartner() { | ||
return partner; | ||
} | ||
|
||
public void setPartner(Frog partner) { | ||
this.partner = partner; | ||
} | ||
|
||
public List<Pond> getPonds() { | ||
return ponds; | ||
} | ||
|
||
public void setPonds(List<Pond> ponds) { | ||
this.ponds = ponds; | ||
} | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
...ent/src/test/java/io/quarkus/resteasy/reactive/jackson/deployment/test/FrogBodyParts.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,45 @@ | ||
package io.quarkus.resteasy.reactive.jackson.deployment.test; | ||
|
||
import io.quarkus.resteasy.reactive.jackson.SecureField; | ||
|
||
public class FrogBodyParts { | ||
|
||
public FrogBodyParts() { | ||
} | ||
|
||
public FrogBodyParts(String bodyPartName) { | ||
this.parts = new BodyPart[] { new BodyPart(bodyPartName) }; | ||
} | ||
|
||
private BodyPart[] parts; | ||
|
||
public BodyPart[] getParts() { | ||
return parts; | ||
} | ||
|
||
public void setParts(BodyPart[] parts) { | ||
this.parts = parts; | ||
} | ||
|
||
public static class BodyPart { | ||
|
||
public BodyPart(String name) { | ||
this.name = name; | ||
} | ||
|
||
public BodyPart() { | ||
} | ||
|
||
@SecureField(rolesAllowed = "admin") | ||
private String name; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
...n/deployment/src/test/java/io/quarkus/resteasy/reactive/jackson/deployment/test/Pond.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,33 @@ | ||
package io.quarkus.resteasy.reactive.jackson.deployment.test; | ||
|
||
import io.quarkus.resteasy.reactive.jackson.SecureField; | ||
|
||
public class Pond { | ||
|
||
@SecureField(rolesAllowed = "admin") | ||
private WaterQuality waterQuality; | ||
|
||
private String name; | ||
|
||
public WaterQuality getWaterQuality() { | ||
return waterQuality; | ||
} | ||
|
||
public void setWaterQuality(WaterQuality waterQuality) { | ||
this.waterQuality = waterQuality; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public enum WaterQuality { | ||
CLEAR, | ||
DIRTY | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
...est/java/io/quarkus/resteasy/reactive/jackson/deployment/test/SecuredPersonInterface.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,7 @@ | ||
package io.quarkus.resteasy.reactive.jackson.deployment.test; | ||
|
||
public interface SecuredPersonInterface { | ||
|
||
String getPublicName(); | ||
|
||
} |
Oops, something went wrong.