ToastShaman / dropwizard-auth-jwt

A Dropwizard authentication filter using JSON Web Token (JWT)
Apache License 2.0
116 stars 50 forks source link

Error setting the JWTConsumer #22

Closed moezubair closed 7 years ago

moezubair commented 8 years ago

Hello, I am geting the following error:

The method setJwtConsumer(JwtConsumer) is undefined for the type JWTAuthFilter.Builder<SimplePrincipal>

when I try to:

        environment.jersey().register(new AuthDynamicFeature(
                new JWTAuthFilter.Builder<SimplePrincipal>()
                    .setJwtConsumer(consumer)
                    .setRealm("realm")
                    .setPrefix("Bearer")
                    .setAuthenticator(new ExampleAuthenticator())
                    .buildAuthFilter()));

I am using your example, but have my own user (called simple principal) any idea why this is happening?

ToastShaman commented 8 years ago

What version of dropwizard-auth-jwt are you using? The example you posted is for the upcoming 1.0 release of Dropwizard. If you are using 0.9.x look at this example.

        environment.jersey().register(new AuthDynamicFeature(
                new JWTAuthFilter.Builder<MyUser>()
                        .setTokenParser(tokenParser)
                        .setTokenVerifier(tokenVerifier)
                        .setRealm("realm")
                        .setPrefix("Bearer")
                        .setAuthenticator(new ExampleAuthenticator())
                        .buildAuthFilter()));
ToastShaman commented 7 years ago

Closing this issue. Please re-open if the issue still persists.