java - Use of CachingAuthenticator in Dropwizard -


i want discard old authentications dropwizard, why i'm using blow configuration of cachingauthenticator.

@override  public void run(webconfiguration configuration, environment environment) {    environment.jersey().register(new activityresource());     cachingauthenticator<basiccredentials, authuser> cachingauthenticator =         new cachingauthenticator<>(environment.metrics(), new webauthenticator(),                  configuration.getauthenticationcachepolicy()); } 

policy in yml file

authenticationcachepolicy: maximumsize=10, expireafteraccess=1m 

my question is: 1) how register(get working) cachingauthenticator every request authenticated.

2) how set expireafteraccess in seconds

3) wich wrong in code, pls suggest...

i don't know about "2)" "1)", need wire authenticator basic auth provider

cachingauthenticator<basiccredentials, authuser> cachingauthenticator =         new cachingauthenticator<>(environment.metrics(), new webauthenticator(),                  configuration.getauthenticationcachepolicy());  environment.jersey().register(authfactory.binder(             new basicauthfactory<>(cachingauthenticator,                      "example realm", authuser.class))); 

Comments