exchange.getOut().setHeader("operation", "CREATE");
Subject subject = SecurityUtils.getSubject();
exchange.getOut().setHeader(SecurityConstants.SECURITY_SUBJECT, subject);
I have created REST endpoints in DDF that use the SecurityUtils.getSubject() method successfully to get the current user but I'm not sure how to get the Subject from within a Camel route inside of DDF. I get the following exception when I try and get the Shiro Subject from my route:
org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager accessible to the calling code, either bound to the org.apache.shiro.util.ThreadContext or as a vm static singleton. This is an invalid application configuration.
at org.apache.shiro.SecurityUtils.getSecurityManager(SecurityUtils.java:123)[207:org.apache.shiro.core:1.2.4]
at org.apache.shiro.subject.Subject$Builder.<init>(Subject.java:627)[207:org.apache.shiro.core:1.2.4]
at org.apache.shiro.SecurityUtils.getSubject(SecurityUtils.java:56)[207:org.apache.shiro.core:1.2.4]
at <MY Processor>.process(MY.java:64)[416:MINE:1.0.0.SNAPSHOT]
at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)[172:org.apache.camel.camel-core:2.16.1]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[172:org.apache.camel.camel-core:2.16.1]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)[172:org.apache.camel.camel-core:2.16.1]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)[172:org.apache.camel.camel-core:2.16.1]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)[172:org.apache.camel.camel-core:2.16.1]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)[172:org.apache.camel.camel-core:2.16.1]
at org.apache.camel.processor.FilterProcessor.process(FilterProcessor.java:57)[172:org.apache.camel.camel-core:2.16.1]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[172:org.apache.camel.camel-core:2.16.1]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)[172:org.apache.camel.camel-core:2.16.1]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)[172:org.apache.camel.camel-core:2.16.1]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)[172:org.apache.camel.camel-core:2.16.1]
at org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:298)[172:org.apache.camel.camel-core:2.16.1]
at org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:207)[172:org.apache.camel.camel-core:2.16.1]
at org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:154)[172:org.apache.camel.camel-core:2.16.1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_60]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_60]
Any help would be greatly appreciated.
Thanks,
Mark
Subject subject = Security.getSystemSubject();
logger.info("Setting Shiro Subject -- " + subject);
exchange.getOut().setHeader("ddf.security.subject", subject);
22:16:17,123 | INFO | nc Dispatcher[0] | MyProcessor 40 | MyProcessor | Setting Shiro Subject -- ddf.security.impl.SubjectImpl@34b18144
22:16:17,123 | DEBUG | nc Dispatcher[0] | nent.catalog.framework.FrameworkProducer 122 | -core-camelcomponent | Entering process method
22:16:17,124 | DEBUG | nc Dispatcher[0] | nent.catalog.framework.FrameworkProducer 552 | -core-camelcomponent | Reading in body data as Metacard...
22:16:17,124 | DEBUG | nc Dispatcher[0] | nent.catalog.framework.FrameworkProducer 558 | -core-camelcomponent | Successfully read in body data as Metacard
22:16:17,124 | DEBUG | nc Dispatcher[0] | nent.catalog.framework.FrameworkProducer 193 | -core-camelcomponent | Validation of Metacard list passed...
22:16:17,124 | DEBUG | nc Dispatcher[0] | nent.catalog.framework.FrameworkProducer 204 | -core-camelcomponent | Making CREATE call to Catalog Framework...
22:16:17,124 | DEBUG | nc Dispatcher[0] | ddf.catalog.impl.CatalogFrameworkImpl 2709 | re-standardframework | Checking if source "my.ddf.distribution" is available...
22:16:17,125 | DEBUG | nc Dispatcher[0] | f.catalog.security.plugin.SecurityPlugin 111 | alog-security-plugin | No security subject found, cannot add to current operation.
--
You received this message because you are subscribed to a topic in the Google Groups "ddf-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ddf-users/Eo1H2zras3g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ddf-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.