>>>>> Steinar Bang <[email protected]>:
>>>>> Alexander Rotnov <[email protected]>:
>> I also faces this problem, while adopt Shiro to Karaf and Pax Web. My
>> solution - do not try to initialize filter from WebEnvironment, as in
>> ShiroFilter.
>> Try to extend AbstractShiroFilter and inject to it WebSecurityManager and
>> FilterChainResolver.
> Thanks! I will try this.
It tried it, but it's kind of weird:
1. The pax exam test that loads the servlet and filter works when run
from maven
2. The pax exam test fails when run from inside eclipse
3. The filter fails when the application is loaded into karaf 4.1.5
That the pax exam test works in one setting and fails in another hints
at something timing releated...?
But I didn't think DS components would have timing issues? They either
become active, or they don't... and a pax exam test with @Inject members
don't actually run anything until all injections have been satisifed.
Anyway, here's the component:
@Component(
property= {
HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN+"=/ukelonn/*",
"servletNames=ukelonn"},
service=Filter.class,
immediate=true
)
public class UkelonnShiroFilter extends AbstractShiroFilter {
private static UkelonnShiroFilter instance;
private UkelonnDatabase database;
WebSecurityManager securitymanager;
FilterChainResolver resolver;
public UkelonnShiroFilter() {
instance = this;
}
@Activate
public void activate() {
setSecurityManager(securitymanager);
if (resolver != null) {
setFilterChainResolver(resolver);
}
}
@Reference
public void setUkelonnDatabase(UkelonnDatabase database) {
this.database = database;
}
public UkelonnDatabase getDatabase() {
return database;
}
@Reference
public void setSecuritymanager(WebSecurityManager securitymanager) {
this.securitymanager = securitymanager;
}
@Reference
public void setResolver(FilterChainResolver resolver) {
this.resolver = resolver;
}
public static UkelonnShiroFilter getInstance() {
return instance;
}
}
--
--
------------------
OPS4J - http://www.ops4j.org - [email protected]
---
You received this message because you are subscribed to the Google Groups
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.