Hi - 

Is it feasible in Camel to make a call to an application which is embedded
with Apache Shiro security. The web application has exposed the
functionalities as rest services. I tried making http calls with Shiro
Authentication token set up in the exchange headers. But its failing.
Basically I am unable to mock the Shiro subject and set in the HTTP header
to make it look like a Shiro Authenticated request. Is this possible in
Camel or am I going in the wrong direction? Any suggestion or help in this
regard is very much appreciated. Below is a subset of code I have been
playing around with.

      
 // wrap it in a Subject
               Subject subjectUnderTest = new
Subject.Builder(getSecurityManager())
               .principals(new SimplePrincipalCollection("Username",
"RealmName"))
               .authenticated(true)
               .buildSubject();    
            
                MockEndpoint OutEndpoint = getMockEndpoint("mock.out");
                OutEndpoint.expectedMessageCount(1);
                
                Endpoint InEndpoint = context.getEndpoint("direct.in");
                Map<String, Object> headers = new HashMap<String, Object>();
                headers.put(Exchange.HTTP_METHOD, "GET");
                headers.put(Exchange.AUTHENTICATION, subjectUnderTest);

                template.sendBodyAndHeaders(InEndpoint, "test body",
headers);

Thanks 
Viggy




--
View this message in context: 
http://camel.465427.n5.nabble.com/Invoking-an-application-secured-with-Apache-shiro-tp5746737.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to