package org.carbon.authentication.handler;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.carbon.authentication.Authenticator;
import org.carbon.component.annotation.Component;
import org.carbon.component.annotation.Inject;
import org.carbon.web.handler.HandlerChain;

/**
 * @author Shota Oda 2017/03/04.
 */
@Component
public class AuthenticationHandlerChain extends HandlerChain {
    @Inject
    private Authenticator authenticator;

    @Override
    protected void chain(HttpServletRequest request, HttpServletResponse response) {
        boolean isAuthenticated = authenticator.authenticate(request, response);
        if (!isAuthenticated) return;

        super.chain(request, response);
    }
}

@@ -164,16 +164,23 @@
 ication.
+Default
 Authenti
@@ -186,16 +186,65 @@
 icator;%0A
+import org.carbon.component.annotation.Assemble;%0A
 import o
@@ -289,55 +289,8 @@
 nt;%0A
-import org.carbon.component.annotation.Inject;%0A
 impo
@@ -454,14 +454,16 @@
    @
-Inject
+Assemble
 %0A   
@@ -471,16 +471,23 @@
 private 
+Default
 Authenti
@@ -609,43 +609,34 @@
 se) 
-%7B%0A        boolean isAuthenticated =
+throws Throwable %7B%0A       
  aut
@@ -683,47 +683,8 @@
 e);%0A
-        if (!isAuthenticated) return;%0A%0A
     

update authorization functionality to use chain