Package co.mastermindcms.client.rest
Class MainApplicationController
- java.lang.Object
-
- co.mastermindcms.client.rest.MainApplicationController
-
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean
@RestController public class MainApplicationController extends java.lang.Object implements org.springframework.beans.factory.InitializingBean
-
-
Field Summary
Fields Modifier and Type Field Description private org.springframework.security.web.authentication.rememberme.PersistentTokenBasedRememberMeServicesadminRememberMeServicesprivate CommonPropertiescommonPropertiesprivate javax.servlet.http.HttpSessionhttpSessionprivate PageRenderServicepageRendererprivate org.springframework.security.crypto.password.PasswordEncoderpasswordEncoderprivate RouterServicerouterServiceprivate TemplateLocatorServicetemplateLocatorServiceprivate UserPrincipalDetailsServiceuserDetailsServiceprivate org.springframework.security.web.authentication.rememberme.PersistentTokenBasedRememberMeServicesuserRememberMeServices
-
Constructor Summary
Constructors Constructor Description MainApplicationController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()org.springframework.http.ResponseEntity<?>loginHandler(AuthRequest authRequest, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Handles the login request.org.springframework.http.ResponseEntity<?>logoutHandler(AuthRequest authRequest, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)This is the entry point for user logoutorg.springframework.http.ResponseEntity<?>templateHandler(java.lang.String site, java.security.Principal principal, java.lang.String lang, javax.servlet.http.HttpServletRequest request)This is entrypoint for HTTP-requests from the clients, where it loads a HTML-template from filesystem.
-
-
-
Field Detail
-
httpSession
@Autowired private javax.servlet.http.HttpSession httpSession
-
pageRenderer
@Autowired private PageRenderService pageRenderer
-
templateLocatorService
@Autowired private TemplateLocatorService templateLocatorService
-
userDetailsService
@Qualifier("userPrincipalDetailsService") @Autowired private UserPrincipalDetailsService userDetailsService
-
passwordEncoder
@Autowired private org.springframework.security.crypto.password.PasswordEncoder passwordEncoder
-
userRememberMeServices
@Qualifier("userRememberMeServices") @Autowired private org.springframework.security.web.authentication.rememberme.PersistentTokenBasedRememberMeServices userRememberMeServices
-
adminRememberMeServices
@Qualifier("adminRememberMeServices") @Autowired private org.springframework.security.web.authentication.rememberme.PersistentTokenBasedRememberMeServices adminRememberMeServices
-
routerService
@Autowired private RouterService routerService
-
commonProperties
@Autowired private CommonProperties commonProperties
-
-
Method Detail
-
loginHandler
@PostMapping(value="/api/v1/authenticate", consumes="application/json") @ResponseBody public org.springframework.http.ResponseEntity<?> loginHandler(@RequestBody AuthRequest authRequest, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Handles the login request.This method handles the login request and authenticates the user using the provided username and password. It also provides an option to remember the user by setting the rememberMe flag to true. The request and response objects are used to retrieve and set the necessary information for the authentication process.
- Parameters:
authRequest- authentication request.request- The HttpServletRequest object containing the request information.response- The HttpServletResponse object used to set the response information.- Returns:
- A ResponseEntity object representing the HTTP response.
-
logoutHandler
@PostMapping("/api/v1/logout") @ResponseBody public org.springframework.http.ResponseEntity<?> logoutHandler(@RequestBody AuthRequest authRequest, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)This is the entry point for user logout- Parameters:
authRequest- authentication requestrequest- http servlet requestresponse- http servlet response- Returns:
- HTTP response
-
templateHandler
@RequestMapping("/{site:^(?!sock).+$}/**/*.html") @ResponseBody public org.springframework.http.ResponseEntity<?> templateHandler(@PathVariable("site") java.lang.String site, java.security.Principal principal, @CookieValue(name="i18next",required=false) java.lang.String lang, javax.servlet.http.HttpServletRequest request)This is entrypoint for HTTP-requests from the clients, where it loads a HTML-template from filesystem.- Parameters:
site- this is identification for a folder in /MSM2/www/{site}, except for "sock" as this was used for WebSocketsprincipal- this is keep authorization data for the requestlang- this is cookie value for a language coderequest- http servlet request- Returns:
- response as valid HTML
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
-