@Test void testBuildChallenge() { assertEquals("Bearer realm=\"trellis\" scope=\"webid\"", WebAcFilter.buildChallenge("Bearer", "trellis", "webid")); assertEquals("Bearer", WebAcFilter.buildChallenge("Bearer", "", "")); }
static String buildChallenge(final String challenge, final String realm, final String scope) { final String realmParam = realm.isEmpty() ? "" : " realm=\"" + realm + "\""; final String scopeParam = scope.isEmpty() ? "" : " scope=\"" + scope + "\""; return challenge + realmParam + scopeParam; }
WebAcFilter implements ContainerRequestFilter, ContainerResponseFilter { static String buildChallenge(final String challenge, final String realm, final String scope) { final String realmParam = realm.isEmpty() ? "" : " realm=\"" + realm + "\""; final String scopeParam = scope.isEmpty() ? "" : " scope=\"" + scope + "\""; return challenge + realmParam + scopeParam; } }
WebAcFilter implements ContainerRequestFilter, ContainerResponseFilter { static String buildChallenge(final String challenge, final String realm, final String scope) { final String realmParam = realm.isEmpty() ? "" : " realm=\"" + realm + "\""; final String scopeParam = scope.isEmpty() ? "" : " scope=\"" + scope + "\""; return challenge + realmParam + scopeParam; } WebAcFilter(); }
WebAcFilter implements ContainerRequestFilter, ContainerResponseFilter { static String buildChallenge(final String challenge, final String realm, final String scope) { final String realmParam = realm.isEmpty() ? "" : " realm=\"" + realm + "\""; final String scopeParam = scope.isEmpty() ? "" : " scope=\"" + scope + "\""; return challenge + realmParam + scopeParam; } WebAcFilter(); @Inject void setAccessService(final WebAcService accessService); @Inject void setResourceService(final ResourceService resourceService); void setChallenges(final List<String> challenges); void setBaseUrl(final String baseUrl); @Timed @Override void filter(final ContainerRequestContext ctx); @Override void filter(final ContainerRequestContext req, final ContainerResponseContext res); }
WebAcFilter implements ContainerRequestFilter, ContainerResponseFilter { static String buildChallenge(final String challenge, final String realm, final String scope) { final String realmParam = realm.isEmpty() ? "" : " realm=\"" + realm + "\""; final String scopeParam = scope.isEmpty() ? "" : " scope=\"" + scope + "\""; return challenge + realmParam + scopeParam; } WebAcFilter(); @Inject void setAccessService(final WebAcService accessService); @Inject void setResourceService(final ResourceService resourceService); void setChallenges(final List<String> challenges); void setBaseUrl(final String baseUrl); @Timed @Override void filter(final ContainerRequestContext ctx); @Override void filter(final ContainerRequestContext req, final ContainerResponseContext res); static final String CONFIG_WEBAC_CHALLENGES; static final String CONFIG_WEBAC_READABLE_METHODS; static final String CONFIG_WEBAC_WRITABLE_METHODS; static final String CONFIG_WEBAC_APPENDABLE_METHODS; static final String CONFIG_WEBAC_REALM; static final String CONFIG_WEBAC_SCOPE; static final String CONFIG_WEBAC_ENABED; static final String SESSION_WEBAC_MODES; }