@@ -0,0 +1,1935 @@
+/*%0A * JBoss, Home of Professional Open Source.%0A * Copyright 2013 Red Hat, Inc., and individual contributors%0A * as indicated by the @author tags.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage io.undertow.security.handlers;%0A%0Aimport java.util.Collection;%0A%0Aimport io.undertow.security.api.NotificationReceiver;%0Aimport io.undertow.security.api.SecurityContext;%0Aimport io.undertow.server.HttpHandler;%0Aimport io.undertow.server.HttpHandlers;%0Aimport io.undertow.server.HttpServerExchange;%0A%0A/**%0A * A %7B@link HttpHandler%7D to register a list of %7B@link NotificationReceiver%7D instances with the current %7B@link SecurityContext%7D.%0A *%0A * @author %3Ca href=%22mailto:darran.lofthouse@jboss.com%22%3EDarran Lofthouse%3C/a%3E%0A */%0Apublic class NotificationReceiverHandler implements HttpHandler %7B%0A%0A    private final HttpHandler next;%0A    private final Collection%3CNotificationReceiver%3E receivers;%0A%0A    public NotificationReceiverHandler(final HttpHandler next, final Collection%3CNotificationReceiver%3E receivers) %7B%0A        this.next = next;%0A        this.receivers = receivers;%0A    %7D%0A%0A    @Override%0A    public void handleRequest(HttpServerExchange exchange) throws Exception %7B%0A        SecurityContext sc = exchange.getAttachment(SecurityContext.ATTACHMENT_KEY);%0A        for (NotificationReceiver receiver : receivers) %7B%0A            sc.registerNotificationReceiver(receiver);%0A        %7D%0A%0A        HttpHandlers.executeHandler(next, exchange);%0A    %7D%0A%0A%7D%0A

Add a new handler that is responsible for registering a Collection of NotificationReceiver instances with the current SecurityContext.