Application architecture setup - GroupInnovations/ap GitHub Wiki
The application has been bootstrapped using Spring Boot. On the server side, the application has following main packages (base package: in.ac.iiitmk.ap)
configurationscontrollersapiservicesrepositoriesmodels
All the client side code is contained in the src/main/resources directory. This directory is further divided into public and pages. public directory contains static resources that does not expose any server side functionality. These include css, javscript, font and images etc. Note that this directory does not contain the images uploaded by the users. This directory also contain the client side libraries under the vendors subdirectory. pages directory contains fragments, templates and html pages that would be shown to the users. The files in this directory are not directly accessible to the users.
More server side setup
The configurations package
The configurations package contains all the application wide java configurations.
WebConfiguration class
WebConfiguration configures static resources that could be serverd to the users without DispatcherServlet's interventions. For this application all the resources that are reuqested via a url starting with /public/ would be directly served to the user. This file also configures a controller method handler. HandlerMethodReturnValueHandler has been implemented by WebControllerMethodReturnTypeHandler in the controllers package that allows controllers to return an instance of Page which could be used to resolve the view files. Page provides methods for redirect and forward. Another reason for doing this was to have a centeralized place where if anything related to the directory structure or the URL changes, these changes would be needed to be made only once.
WebSecurity class
Until issue #6 is fixed, we are using InMemory authentication.
The class has two methods - for configuring authentication method and for configuring the restrictions and ways of logging in. The class injects the instance of ISecurityProvider which has a build method that takes the instance of AuthenticationManagerBuilder and then builds the manager. This interface should be implemented by the SecurityProviders eg. LDAP, Database Based or InMemory. The globalSecurityConfigurationBuilder method in WebSecurity injects an instance of AuthenticationManagerBuilder and passes it to the build method.
ISecurityProvideris a Java 8FunctionalInterface.