With my very simple JAX-RS service I'm using Tomcat with JDBC realm for authentication, therefore I'm working the the JSR 250 annotations.
The thing is that I want to return a custom message body in the HTTP status response. The status code (403)…
I'm working on a project that has to run on Java SE 5 and Java SE 6. I recently started using a tool that adds @Generated annotations to generated code, and I want to keep those annotations. It looks like javax.annotation.Generated is in Java 5 EE…
I have a web service client generated and built with Apache CXF. Next I have JAX-RS Jersey application in which I want to call methods from that webservice. When I try to deploy this simple project to Glassfish 4.0 server I get this…
When updating to Spring Security 6, the JSR250 annotation @RolesAllowed on my @RestController doesn't take the defined roleHierarchy into account.
Related to: AccessDecisionVoter Deprecated with Spring Security 6.x
Since Spring Security 6, the…
I'm looking at the Java EE 6 specification section EE.6.25, which indicates that web containers must support the following annotations: @PermitAll, @DenyAll, @RolesAllowed, @DeclareRoles and @RunAs.
EE.6.25 Common Annotations for the Java™ Platform…
I'm seeing an issue with the JSR-330 @Inject annotation not populating the ApplicationContext into my bean. When using the JSR-250 @Resource annotation it gets injected properly. Yes, I know I could have MyClass implement ApplicationContextAware,…
I've overwritten the BasicAuthenticationFilter and replaced it with our a filter to fetch a custom Authentication object from db and set it via
SecurityContextHolder.getContext().setAuthentication(auth);
Here is the important fraction of the…
We are trying to add unit testing to our Spring project Controllers (BTW, the Integration tests work fine), but we are suffering a very odd behavior, When we add the Configuration with @EnableGlobalMethodSecurity (with JSR-250 annotations) if the…
I was reading through a Spring tutorial and came across the following example. It mentioned that Spring supports the Java EE annotation @Resource. I was trying the example with the source below, but it gave an InvocationTargetException. I suppose it…
I'm starting my way with google guice.
Since guice does not support jsr-250 annotations out of the box I'm trying to bridge this gap. Specifically I'm interested on using @PostConstruct and @PreDestroy annotations.
I tried following guiceyfruit as…
I'm trying to add security on a Jersey(2.x) rest controller on a Spring boot(1.2.5) application. My Project use spring boot starter: web, security and jersey.
The Spring Security config
@EnableGlobalMethodSecurity(jsr250Enabled =…
I try to move from @Configuration based security to JSR 250 method level security. The code below works as follows:
Access to my page is configured in configure(HttpSecurity http) inside SecurityConfiguration.class. Everyone is allowed to access…
How the Configuration should look like when using @RolesAllowed Annotation?
I don't need any auth at my webpage as there's no login or anything else. Only the admin panel should have an http basic auth.
This is my current code:
public class…
Spring security jsp tag authorize can be used to check against the url:
It uses WebInvocationPrivilegeEvaluator for evaluation. The rules has been taken from HttpSecurity config:
@Bean
…