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.
Fail deployment if multiple security annotations are present
Fixes quarkusio#10483
- Loading branch information
1 parent
c32c54d
commit b189411
Showing
4 changed files
with
72 additions
and
12 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
12 changes: 12 additions & 0 deletions
12
extensions/security/deployment/src/test/java/io/quarkus/security/test/cdi/InvalidBean.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,12 @@ | ||
package io.quarkus.security.test.cdi; | ||
|
||
import javax.annotation.security.RolesAllowed; | ||
import javax.enterprise.context.ApplicationScoped; | ||
|
||
import io.quarkus.security.Authenticated; | ||
|
||
@ApplicationScoped | ||
@Authenticated | ||
@RolesAllowed("admin") | ||
public class InvalidBean { | ||
} |
34 changes: 34 additions & 0 deletions
34
...urity/deployment/src/test/java/io/quarkus/security/test/cdi/InvalidClassBeanTestCase.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,34 @@ | ||
package io.quarkus.security.test.cdi; | ||
|
||
import java.util.function.Consumer; | ||
import java.util.function.Supplier; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class InvalidClassBeanTestCase { | ||
@RegisterExtension | ||
static QuarkusUnitTest test = new QuarkusUnitTest() | ||
.setArchiveProducer(new Supplier<JavaArchive>() { | ||
@Override | ||
public JavaArchive get() { | ||
return ShrinkWrap.create(JavaArchive.class) | ||
.addClass(InvalidBean.class); | ||
} | ||
}).assertException(new Consumer<Throwable>() { | ||
@Override | ||
public void accept(Throwable throwable) { | ||
Assertions.assertEquals(IllegalStateException.class, throwable.getClass()); | ||
} | ||
}); | ||
|
||
@Test | ||
public void testRejected() { | ||
Assertions.fail(); | ||
} | ||
} |
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