Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plans to upgrade to Jersey 2? #6

Closed
derekcicerone-zz opened this issue Nov 13, 2014 · 10 comments
Closed

Plans to upgrade to Jersey 2? #6

derekcicerone-zz opened this issue Nov 13, 2014 · 10 comments

Comments

@derekcicerone-zz
Copy link

Love this library - we were wondering if you have plans to upgrade it for Jersey 2 in DropWizard 0.8.0.

@silb
Copy link
Owner

silb commented Nov 16, 2014

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.

@derekcicerone-zz
Copy link
Author

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.

@silb
Copy link
Owner

silb commented Nov 23, 2014

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.

@derekcicerone-zz
Copy link
Author

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.

@silb
Copy link
Owner

silb commented Dec 9, 2014

FYI, work on Jersey 2 and Dropwizard 0.8 is in progress.

@segfly
Copy link

segfly commented Feb 17, 2015

+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?

@silb
Copy link
Owner

silb commented Feb 18, 2015

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.

@segfly
Copy link

segfly commented Feb 18, 2015

@silb Great! I wasn't sure what state those branches were in. Are both projects the same in this regard? Thanks.

@silb
Copy link
Owner

silb commented Feb 20, 2015

Yes, the branches in both projects are in a working state. All the tests passes.

@silb
Copy link
Owner

silb commented Mar 15, 2015

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

@silb silb closed this as completed Mar 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants