GithubHelp home page GithubHelp logo

Comments (10)

silb avatar silb commented on May 22, 2024

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.

derekcicerone-zz avatar derekcicerone-zz commented on May 22, 2024

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.

silb avatar silb commented on May 22, 2024

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.

derekcicerone-zz avatar derekcicerone-zz commented on May 22, 2024

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.

silb avatar silb commented on May 22, 2024

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

from shiro-jersey.

segfly avatar segfly commented on May 22, 2024

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

silb avatar silb commented on May 22, 2024

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.

segfly avatar segfly commented on May 22, 2024

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

from shiro-jersey.

silb avatar silb commented on May 22, 2024

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

from shiro-jersey.

silb avatar silb commented on May 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.