camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brendle, Detlef" <detlef.bren...@prospective.ch>
Subject Re: org.apache.camel.InvalidPayloadException after adding a @PreAuthorized Annotation to service method
Date Thu, 07 Jan 2016 11:46:23 GMT
PreAuthorize is a security annotation from Spring.

org.springframework.security.access.prepost.PreAuthorize

@Target({ ElementType.METHOD, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface PreAuthorize {
   /**
    * @return the Spring-EL expression to be evaluated before invoking
the protected
    * method
    */
   String value();
}



2016-01-07 12:42 GMT+01:00 Claus Ibsen <claus.ibsen@gmail.com>:

> Maybe the annotations creates some kind of proxy object that has a
> method signature with a different type than the method itself.
>
> Where is that @PreAuthorize coming from?
>
> On Thu, Jan 7, 2016 at 12:38 PM, Brendle, Detlef
> <detlef.brendle@prospective.ch> wrote:
> > Hi all,
> >
> > I am facing an issue that I dont know how to solve.
> > For Security Reasons I needed to secure a service method that is also
> > called from a camel route.
> >
> > <route id="mail.standard.async">
> >     <from uri="direct:sendMailStandardAsync"/>
> >     <bean ref="mailService" method="prepareMailHeader"/>
> >     <to uri="velocity://dummy"/>
> >     <wireTap uri="direct:sendMailStandardSync"/>
> >     <transform>
> >         <constant>OK</constant>
> >     </transform>
> > </route>
> >
> >
> >
> > @PreAuthorize("hasRole('" + BerechtigungName.ROLE_USER + "')")
> > public void sendMailStandardAsync(*MailInfo* mailInfo) {
> >     LOG.info("Sending email to [{}]", mailInfo.getTo());
> >     template.sendBody("direct:sendMailStandardAsync", mailInfo);
> > }
> >
> > But now If the route is called I get an Exception:
> >
> > *No type converter available to convert from type:
> > ch.prospective.njc.integration.mail.service.MailInfo to the required
> > type: java.util.Map with value MailInfo*
> >
> >
> > If I remove the Annotation again, everything works fine. So I assume that
> > somehow the annotation becomes part of the camel treatment.
> >
> > Does anybody know how to solve this issue ?
> >
> >
> > Thanks,
> > Detlef
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>



-- 

Prospective Media Services

Hofackerstrasse 32

CH-8032 Zürich



Phone  +41 44 384 55 19

detlef.brendle@prospective.ch <info@prospective.ch>

www.prospective.ch

blog.prospective.ch


[image: Inline-Bild 1] <http://blog.prospective.ch/>  [image: Inline-Bild 8]
<http://www.facebook.com/ProspectiveMedia>  [image: Inline-Bild 7]
<https://plus.google.com/b/110350987305707874053/?tab=XX#110350987305707874053/posts>
[image: Inline-Bild 5] <http://twitter.com/ProspectiveAG>  [image:
Inline-Bild 3] <http://www.xing.com/companies/prospectivemediaservicesag>
 [image:
Inline-Bild 4]
<http://www.linkedin.com/company/prospective-media-services-ag>  [image:
Inline-Bild 6]
<http://www.kununu.com/ch/zh/zuerich/me/prospective-media-services>  [image:
Inline-Bild 10] <http://www.youtube.com/prospectivemedia/>  [image:
Inline-Bild 9] <http://www.flickr.com/photos/prospectivemedia/>  [image:
Inline-Bild 2] <http://www.prospective.ch/news/rss/index.xml>

PROSPECTIVE – FÜR UMFASSENDE RECRUITING-SOLUTIONS

Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message