@Override public boolean onEnable(Configuration c) { for (Class<?> provider : JsonJaxbModule.getProviders()) { c.register(provider); } return true; } }
@Override public boolean onEnable(Configuration c) { for (Class<?> provider : JsonJacksonModule.getProviders()) { c.register(provider); } return true; } }
public String signed(final String projectName, WebTarget target) { if (username == null) throw new NullPointerException("username is null"); if (password == null) throw new NullPointerException("password is null"); if (tokenFactory == null) throw new NullPointerException("idp is null"); final String access = obtainSignedToken(projectName); ClientRequestFilter tokenFilter = new ClientRequestFilter() { @Override public void filter(ClientRequestContext requestContext) throws IOException { requestContext.getHeaders().putSingle("X-Auth-Signed-Token", access); } }; target.configuration().register(tokenFilter); return access; }
public Access authenticateTarget(final String projectName, WebTarget target) { if (username == null) throw new NullPointerException("username is null"); if (password == null) throw new NullPointerException("password is null"); if (tokenFactory == null) throw new NullPointerException("idp is null"); final Access access = obtainToken(projectName); ClientRequestFilter tokenFilter = new ClientRequestFilter() { volatile Access token = access; @Override public void filter(ClientRequestContext requestContext) throws IOException { Access tmp = token; if (tmp.getToken().expired()) { synchronized (this) { tmp = token; if (tmp.getToken().expired()) { token = tmp = obtainToken(projectName); } } } requestContext.getHeaders().putSingle("X-Auth-Token", tmp.getToken().getId()); } }; target.configuration().register(tokenFilter); return access; }