Questions tagged [jsr250]

JSR 250: Common Annotations for the Java Platform

Specification: JSR 250

23 questions
16
votes
3 answers

Custom HTTP status response with JAX-RS (Jersey) and @RolesAllowed

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)…
Stefan
  • 582
  • 1
  • 5
  • 17
6
votes
3 answers

How do I add javax.annotation.Generated to Java SE 5?

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…
rob
  • 6,147
  • 2
  • 37
  • 56
6
votes
1 answer

How to deploy Apache CXF webservice to Glassfish

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…
Michal J.
  • 1,765
  • 3
  • 14
  • 11
3
votes
1 answer

Configure JSR250 role hierarchy in Spring 6

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…
cjtfd
  • 31
  • 3
3
votes
1 answer

@RolesAllowed, @DenyAll usage in web tier?

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…
Patrick Garner
  • 3,201
  • 6
  • 39
  • 58
2
votes
1 answer

JSR-250 vs JSR-330 for injecting Application Context

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,…
joecoder
  • 325
  • 4
  • 18
1
vote
1 answer

Spring Authorization via Annotations not working with custom Authentication

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…
Karussell
  • 17,085
  • 16
  • 97
  • 197
1
vote
1 answer

Spring MVC - Error 404 with @EnableGlobalMethodSecurity when testing Controller using @WebMvcTest

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…
Roberto
  • 8,586
  • 3
  • 42
  • 53
1
vote
0 answers

Spring - @Resource annotation - InvocationTargetException on runtime

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…
Patrick C.
  • 1,339
  • 3
  • 16
  • 31
1
vote
1 answer

JSR-250 lifecycle annotations: Annotation Type PreDestroy

Is the method @PreDestroy of a prototype bean called when the bean is garbage collected ?
La Carbonell
  • 1,976
  • 5
  • 22
  • 52
1
vote
0 answers

Allow @PostConstruct annotation on Google Guice based app

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…
forhas
  • 11,551
  • 21
  • 77
  • 111
1
vote
0 answers

Security method with Jersey and Spring security

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 =…
herau
  • 1,466
  • 2
  • 18
  • 36
1
vote
1 answer

JSR 250 method level security does not work in Spring MVC

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…
Marek Raki
  • 3,056
  • 3
  • 27
  • 50
1
vote
1 answer

Spring Security JavaConfig with HTTP Basic and JSR-250: 403 Forbidden

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…
dtrunk
  • 4,685
  • 17
  • 65
  • 109
0
votes
1 answer

spring web security sec:authorize url with JSR 250 (@RolesAllowed)

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 …
1
2