Index: src/main/java/edu/gjoko/schedlr/config/AppAuthenticationFailureHandler.java
===================================================================
--- src/main/java/edu/gjoko/schedlr/config/AppAuthenticationFailureHandler.java	(revision 943857ccadc5bd0933c2bd0b003629ae75c29b17)
+++ 	(revision )
@@ -1,26 +1,0 @@
-package edu.gjoko.schedlr.config;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.security.authentication.BadCredentialsException;
-import org.springframework.security.authentication.InternalAuthenticationServiceException;
-import org.springframework.security.core.AuthenticationException;
-import org.springframework.security.web.authentication.AuthenticationFailureHandler;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-public class AppAuthenticationFailureHandler implements AuthenticationFailureHandler {
-
-    protected Log logger = LogFactory.getLog(this.getClass());
-    @Override
-    public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException {
-      if (exception instanceof InternalAuthenticationServiceException) {
-          response.sendRedirect(request.getContextPath() + "/login?error=notApproved");
-      } else if (exception instanceof BadCredentialsException) {
-          response.sendRedirect(request.getContextPath() + "/login?error=badCredentials");
-      }
-    }
-}
Index: src/main/java/edu/gjoko/schedlr/config/AppAuthenticationSuccessHandler.java
===================================================================
--- src/main/java/edu/gjoko/schedlr/config/AppAuthenticationSuccessHandler.java	(revision cf9cdbf9e2bef95a0adc1db2bc845ef45bf080d8)
+++ src/main/java/edu/gjoko/schedlr/config/AppAuthenticationSuccessHandler.java	(revision cf9cdbf9e2bef95a0adc1db2bc845ef45bf080d8)
@@ -0,0 +1,67 @@
+package edu.gjoko.schedlr.config;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.web.DefaultRedirectStrategy;
+import org.springframework.security.web.RedirectStrategy;
+import org.springframework.security.web.WebAttributes;
+import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+public class AppAuthenticationSuccessHandler implements AuthenticationSuccessHandler {
+
+    protected Log logger = LogFactory.getLog(this.getClass());
+    private final RedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
+
+    @Override
+    public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
+        handle(request, response, authentication);
+        clearAuthenticationAttributes(request);
+    }
+
+    protected void handle(HttpServletRequest request,
+                          HttpServletResponse response,
+                          Authentication authentication) throws IOException {
+        String targetUrl = determineTargetUrl(authentication);
+
+        if (response.isCommitted()) {
+            logger.debug("Response has already been committed. Unable to redirect to " +
+                    targetUrl);
+            return;
+        }
+        redirectStrategy.sendRedirect(request, response, targetUrl);
+    }
+
+    protected String determineTargetUrl(final Authentication authentication) {
+        Map<String, String> roleTargetUrlMap = new HashMap<>();
+        roleTargetUrlMap.put("DATE", "/date");
+        roleTargetUrlMap.put("GUESS_NUMBER", "/number");
+
+        final Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();
+        for (final GrantedAuthority grantedAuthority : authorities) {
+            String authorityName = grantedAuthority.getAuthority();
+            if (roleTargetUrlMap.containsKey(authorityName)) {
+                return roleTargetUrlMap.get(authorityName);
+            }
+        }
+        throw new IllegalStateException();
+    }
+
+    protected void clearAuthenticationAttributes(HttpServletRequest request) {
+        HttpSession session = request.getSession(false);
+        if (session == null) {
+            return;
+        }
+        session.removeAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);
+    }
+}
Index: src/main/java/edu/gjoko/schedlr/config/AppConfig.java
===================================================================
--- src/main/java/edu/gjoko/schedlr/config/AppConfig.java	(revision 943857ccadc5bd0933c2bd0b003629ae75c29b17)
+++ 	(revision )
@@ -1,27 +1,0 @@
-package edu.gjoko.schedlr.config;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.security.config.core.GrantedAuthorityDefaults;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.security.web.authentication.AuthenticationFailureHandler;
-import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
-
-@Configuration
-public class AppConfig {
-    @Bean
-    public BCryptPasswordEncoder bCryptPasswordEncoder() {
-        return new BCryptPasswordEncoder();
-    }
-
-
-    @Bean
-    public AuthenticationFailureHandler appAuthenticationFailureHandler() {
-        return new AppAuthenticationFailureHandler();
-    }
-
-    @Bean
-    GrantedAuthorityDefaults grantedAuthorityDefaults() {
-        return new GrantedAuthorityDefaults("");
-    }
-}
Index: src/main/java/edu/gjoko/schedlr/config/AppFilter.java
===================================================================
--- src/main/java/edu/gjoko/schedlr/config/AppFilter.java	(revision 943857ccadc5bd0933c2bd0b003629ae75c29b17)
+++ src/main/java/edu/gjoko/schedlr/config/AppFilter.java	(revision cf9cdbf9e2bef95a0adc1db2bc845ef45bf080d8)
@@ -1,16 +1,14 @@
 package edu.gjoko.schedlr.config;
 
-import edu.gjoko.schedlr.services.PostgresUserDetailsService;
-import lombok.RequiredArgsConstructor;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.context.SecurityContextImpl;
 import org.springframework.security.core.userdetails.UserDetails;
-import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.filter.GenericFilterBean;
 
-import javax.servlet.*;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 import java.io.IOException;
@@ -19,63 +17,30 @@
 import java.util.Map;
 
-@RequiredArgsConstructor
 public class AppFilter extends GenericFilterBean {
-
-    private final PostgresUserDetailsService userDetailsService;
     @Override
     public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
         HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
         HttpSession session = httpServletRequest.getSession(false);
-        HttpServletResponse response = (HttpServletResponse) servletResponse;
-
-        if(httpServletRequest.getRequestURI().endsWith(".js")
-                || httpServletRequest.getRequestURI().endsWith(".css")) {
-            filterChain.doFilter(servletRequest, servletResponse);
-            return;
-        }
-
-        if(httpServletRequest.getRequestURI().startsWith("/api")) {
-            session = ((HttpServletRequest) servletRequest).getSession(true);
-            SecurityContextImpl sci = (SecurityContextImpl) session.getAttribute("SPRING_SECURITY_CONTEXT");
-
-            if(sci != null && session.getAttribute("stakeholderId") == null) {
-                UserDetails userDetails = (UserDetails) sci.getAuthentication().getPrincipal();
-                Long stakeholderId = userDetailsService.loadStakeholderId(userDetails.getUsername());
-                session.setAttribute("stakeholderId", stakeholderId);
-            }
-            filterChain.doFilter(servletRequest, servletResponse);
-            return;
-        }
 
         if(session != null) {
+            Map<String, String> roleTargetUrlMap = new HashMap<>();
+            roleTargetUrlMap.put("DATE", "/date");
+            roleTargetUrlMap.put("GUESS_NUMBER", "/number");
             SecurityContextImpl sci = (SecurityContextImpl) session.getAttribute("SPRING_SECURITY_CONTEXT");
             if(sci != null) {
                 UserDetails userDetails = (UserDetails) sci.getAuthentication().getPrincipal();
-                Long stakeholderId = userDetailsService.loadStakeholderId(userDetails.getUsername());
-                session.setAttribute("stakeholderId", stakeholderId);
-
                 final Collection<? extends GrantedAuthority> authorities = userDetails.getAuthorities();
                 for (final GrantedAuthority grantedAuthority : authorities) {
                     String authorityName = grantedAuthority.getAuthority();
-                    String page = "";
-                    switch (authorityName) {
-                        case "ADMIN":
-                            page = "/admin";
-                            break;
-                        case "CUSTOMER":
-                            if ("/customer_admin".equals(httpServletRequest.getRequestURI())) {
-                                page = "/customer_admin";
-                            } else {
-                                page = "/homepage";
-                            }
-                            break;
-                        case "BUSINESS_OWNER":
-                            page = "/business_admin";
-                            break;
-                        default:
-                            break;
-                    }
-                    if(page != null && !page.trim().isEmpty() && !DispatcherType.ERROR.equals(servletRequest.getDispatcherType())) {
-                        servletRequest.getRequestDispatcher(page).forward(servletRequest, servletResponse);
+                    if("DATE".equalsIgnoreCase(authorityName)) {
+                        servletRequest.getRequestDispatcher("date").forward(servletRequest, servletResponse);
+                        return;
+                    } else if("GUESS_NUMBER".equalsIgnoreCase(authorityName)) {
+                        try {
+                            servletRequest.getRequestDispatcher("number").forward(servletRequest, servletResponse);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+
                         return;
                     }
Index: src/main/java/edu/gjoko/schedlr/config/AppSecurityConfig.java
===================================================================
--- src/main/java/edu/gjoko/schedlr/config/AppSecurityConfig.java	(revision 943857ccadc5bd0933c2bd0b003629ae75c29b17)
+++ src/main/java/edu/gjoko/schedlr/config/AppSecurityConfig.java	(revision cf9cdbf9e2bef95a0adc1db2bc845ef45bf080d8)
@@ -1,81 +1,57 @@
 package edu.gjoko.schedlr.config;
 
-import edu.gjoko.schedlr.services.PostgresUserDetailsService;
-import lombok.AllArgsConstructor;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.security.authentication.AuthenticationManager;
-import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
 import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.config.core.GrantedAuthorityDefaults;
+import org.springframework.security.core.userdetails.User;
+import org.springframework.security.core.userdetails.UserDetailsService;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.security.web.authentication.AuthenticationFailureHandler;
-import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
-import org.springframework.security.web.authentication.logout.HeaderWriterLogoutHandler;
-import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
+import org.springframework.security.provisioning.InMemoryUserDetailsManager;
+import org.springframework.security.provisioning.UserDetailsManager;
+import org.springframework.security.web.SecurityFilterChain;
 import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
-import org.springframework.security.web.header.writers.ClearSiteDataHeaderWriter;
-
-import static org.springframework.security.web.header.writers.ClearSiteDataHeaderWriter.Directive.*;
 
 @Configuration
-@EnableWebSecurity
-@AllArgsConstructor
-public class AppSecurityConfig extends WebSecurityConfigurerAdapter {
-
-    private static final ClearSiteDataHeaderWriter.Directive[] SOURCE =
-            {CACHE, COOKIES, STORAGE, EXECUTION_CONTEXTS};
-
-    private final PostgresUserDetailsService userDetailsService;
-
-    private final BCryptPasswordEncoder passwordEncoder;
-
-    private final AuthenticationFailureHandler authenticationFailureHandler;
+public class AppSecurityConfig {
 
     @Bean
-    public AuthenticationManager customAuthenticationManager() throws Exception {
-        return authenticationManager();
-    }
-
-    @Override
-    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
-        auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder);
-    }
-
-    @Override
-    protected void configure(HttpSecurity http) throws Exception {
-        http.csrf()
+    public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
+        http
+                .csrf()
                 .disable()
+                .authorizeRequests(urlRegistry -> urlRegistry
+                        .antMatchers("/login*").permitAll()
+                        .antMatchers("/css/**").permitAll()
+                        .antMatchers("/anonymous*").permitAll()
+                        .anyRequest()
+                        .fullyAuthenticated()
+                )
                 .httpBasic()
                 .authenticationEntryPoint(new AppAuthenticationEntryPoint())
                 .and()
-                .addFilterAfter(new AppFilter(userDetailsService), BasicAuthenticationFilter.class)
+                .addFilterBefore(new AppFilter(), BasicAuthenticationFilter.class)
                 .formLogin()
                 .loginPage("/login")
                 .loginProcessingUrl("/login")
-                .failureHandler(authenticationFailureHandler)
-                .defaultSuccessUrl("/login")
-                .and()
-                .logout(logout -> logout
-                        .logoutUrl("/logout")
-                        .logoutSuccessUrl("/login")
-                        .addLogoutHandler(new SecurityContextLogoutHandler())
-                        .addLogoutHandler(new HeaderWriterLogoutHandler(new ClearSiteDataHeaderWriter(SOURCE))))
-                .authorizeRequests()
-                .antMatchers("/login").permitAll()
-                .antMatchers("/logout").permitAll()
-                .antMatchers("/register_customer").permitAll()
-                .antMatchers("/register_business").permitAll()
-                .antMatchers("/api/nomenclature/*").permitAll()
-                .antMatchers("/api/user/me").permitAll()
-                .antMatchers("/api/business").permitAll()
-                .antMatchers("/api/appointment").permitAll()
-                .antMatchers("/homepage").permitAll()
-                .antMatchers("/css/**").permitAll()
-                .antMatchers("/js/**").permitAll()
-                .antMatchers("/anonymous*").anonymous()
-                .anyRequest()
-                .fullyAuthenticated();
+                .successHandler(new AppAuthenticationSuccessHandler());
+
+        return http.build();
     }
+
+    @Bean
+    public UserDetailsManager userDetailsService() {
+        return null;
+    }
+
+    @Bean
+    public BCryptPasswordEncoder bCryptPasswordEncoder() {
+        return new BCryptPasswordEncoder();
+    }
+
+    @Bean
+    public GrantedAuthorityDefaults grantedAuthorityDefaults() {
+        return new GrantedAuthorityDefaults("");
+    }
+
 }
Index: src/main/java/edu/gjoko/schedlr/config/ExceptionHandlerAdvice.java
===================================================================
--- src/main/java/edu/gjoko/schedlr/config/ExceptionHandlerAdvice.java	(revision 943857ccadc5bd0933c2bd0b003629ae75c29b17)
+++ 	(revision )
@@ -1,19 +1,0 @@
-package edu.gjoko.schedlr.config;
-
-import edu.gjoko.schedlr.exceptions.BlockingTimeException;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ControllerAdvice;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.context.request.WebRequest;
-import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
-
-@ControllerAdvice
-public class ExceptionHandlerAdvice extends ResponseEntityExceptionHandler {
-
-    @ExceptionHandler(value = BlockingTimeException.class)
-    protected ResponseEntity<Object> handleConflict(RuntimeException ex, WebRequest request) {
-        return handleExceptionInternal(ex, ex.getMessage(), new HttpHeaders(), HttpStatus.CONFLICT, request);
-    }
-}
Index: src/main/java/edu/gjoko/schedlr/config/MvcConfig.java
===================================================================
--- src/main/java/edu/gjoko/schedlr/config/MvcConfig.java	(revision 943857ccadc5bd0933c2bd0b003629ae75c29b17)
+++ src/main/java/edu/gjoko/schedlr/config/MvcConfig.java	(revision cf9cdbf9e2bef95a0adc1db2bc845ef45bf080d8)
@@ -11,10 +11,7 @@
     public void addViewControllers(ViewControllerRegistry registry) {
         registry.addViewController("/login").setViewName("login");
-        registry.addViewController("/register_customer").setViewName("register_customer");
-        registry.addViewController("/register_business").setViewName("register_business");
+        registry.addViewController("/register/user").setViewName("register_user");
+        registry.addViewController("/register/business").setViewName("register_business");
         registry.addViewController("/homepage").setViewName("homepage");
-        registry.addViewController("/admin").setViewName("admin");
-        registry.addViewController("/business_admin").setViewName("business_admin");
-        registry.addViewController("/customer_admin").setViewName("customer_admin");
     }
 }
