2 * Copyright (c) 2018 Red Hat, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.aaa.web;
11 * Secures a {@link WebContext.Builder}.
13 * @author Michael Vorburger.ch
15 public interface WebContextSecurer {
17 * Configure the WebContext to require auth for specified URLs.
20 * Configure the WebContext so that it requires authentication to access the
21 * given URL Patterns. Typically, this will be done by adding a {@code javax.servlet.Filter} (or several, and
22 * whatever else they need).
24 * @param webContextBuilder builder to secure
25 * @param asyncSupported true if asynchronous communication should also be supported
26 * @param urlPatterns URL patterns that require authentication
28 void requireAuthentication(WebContext.Builder webContextBuilder, boolean asyncSupported, String... urlPatterns);
31 * Configure the WebContext to require auth for specified URLs.
34 * Configures the WebContext so that it requires authentication to access the
35 * given URL Patterns. Typically, this will be done by adding a {@code javax.servlet.Filter} (or several, and
36 * whatever else they need).
39 * This method is equivalent to {@code requireAuthentication(webContextBuilder, false, urlPatterns}.
41 * @param webContextBuilder builder to secure
42 * @param urlPatterns URL patterns that require authentication
44 default void requireAuthentication(final WebContext.Builder webContextBuilder, final String... urlPatterns) {
45 requireAuthentication(webContextBuilder, false, urlPatterns);
49 * Configure the WebContext to require auth all URLs.
52 * Configures the WebContext so that all its URL patterns ({@code/**}) require authentication.
54 * @param webContextBuilder builder to secure
55 * @see #requireAuthentication(WebContext.Builder, String...)
57 default void requireAuthentication(final WebContext.Builder webContextBuilder) {
58 requireAuthentication(webContextBuilder, "/*");