Comments (10)
I'm glad you find it useful.
But yes, it must work on DropWizard 0.8, though I haven't started working on it yet.
from shiro-jersey.
Not sure if you would want to take the same approach, but after some prototyping I was able to leverage the dropwizard-auth library for 0.8 to hook things up with minimal coding. I basically just hooked into the interfaces exposed by the auth library and things seem to work. I need to do some more testing but 0.8 may actually be easier to integrate with.
from shiro-jersey.
It won't be so easy since this module doesn't depend on Dropwizard. The way custom objects are injected changed in a non-backward compatible way between Jersey 1.x and 2.x.
The Dropwizard module is simply a thin wrapper around this module.
from shiro-jersey.
Yup, understood - I ended up fixing it for us by leveraging dropwizard-auth and writing this glue code:
public final class ShiroAuthFactory extends AuthFactory<BasicCredentials, Subject> {
private final boolean authEnabled;
public ShiroAuthFactory(boolean authEnabled) {
super(null);
this.authEnabled = authEnabled;
}
@Override
@CheckForNull
public Subject provide() {
if (this.authEnabled) {
return SecurityUtils.getSubject();
}
return null;
}
@Override
public void setRequest(HttpServletRequest request) {
// does nothing since Shiro handles the actual authentication
}
@Override
public AuthFactory<BasicCredentials, Subject> clone(boolean required) {
return new ShiroAuthFactory(this.authEnabled);
}
@Override
public Class<Subject> getGeneratedClass() {
return Subject.class;
}
}
We support the ability to enable/disable auth so if someone wants to turn this into a library I suspect it would be even simpler.
from shiro-jersey.
FYI, work on Jersey 2 and Dropwizard 0.8 is in progress.
from shiro-jersey.
+1 I definitely prefer your library over dw-shiro-bundle because yours supports declarative authorizations. Unfortunately, we need Dropwizard 0.8 due to other dependencies and currently dw-shiro-bundle works with 0.8.
Any idea on release date?
from shiro-jersey.
I don't have a release date for you.
But the Dropwizard 0.8 / Jersey 2 work is pretty much done. What remains is some documentation and merging the changes back into master. And I'm also waiting for Dropwizard 0.8 to be released.
If you need them now you can build your own binaries from the branches I linked to in my previous comment.
from shiro-jersey.
@silb Great! I wasn't sure what state those branches were in. Are both projects the same in this regard? Thanks.
from shiro-jersey.
Yes, the branches in both projects are in a working state. All the tests passes.
from shiro-jersey.
New versions are available in Maven Central:
- Version 0.2.0 of
org.secnod.shiro:shiro-jersey
supporting Jersey 2 - Version 0.2.0 of
org.secnod.dropwizard:dropwizard-shiro
supporting Dropwizard 0.8.0
from shiro-jersey.
Related Issues (11)
- Release HOT 6
- README uses deprecated example HOT 2
- "secnod" or "second" HOT 1
- How the login will be performed. HOT 3
- UnauthorizedException HOT 2
- It seems that Filter doesn't take effect HOT 1
- CORS OPTIONS pass-through HOT 1
- Not compatible with Jersey 2.26-b06 HOT 29
- Parameter injection is performed regardless of annotation
- Migrate to Jakarta APIs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shiro-jersey.