1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.mobility.auth.controllers;
17
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
20 import org.kuali.mobility.auth.service.AuthService;
21 import org.kuali.mobility.shared.Constants;
22 import org.springframework.stereotype.Controller;
23 import org.springframework.ui.Model;
24 import org.springframework.web.bind.annotation.PathVariable;
25 import org.springframework.web.bind.annotation.RequestMapping;
26 import org.springframework.web.bind.annotation.RequestMethod;
27
28 import javax.annotation.Resource;
29 import javax.servlet.http.HttpServletRequest;
30 import java.util.Properties;
31
32
33
34
35
36
37 @Controller
38 @RequestMapping("/auth")
39 public class AuthControllerImpl {
40
41
42
43
44 private static final Logger LOG = LoggerFactory.getLogger( AuthControllerImpl.class );
45
46 @Resource(name="authService")
47 private AuthService service;
48
49 @Resource(name="kmeProperties")
50 private Properties kmeProperties;
51
52
53
54
55 @RequestMapping(method = RequestMethod.GET)
56 public String index(HttpServletRequest request, Model uiModel) {
57 String viewName = null;
58
59 if( "3".equalsIgnoreCase( getKmeProperties().getProperty("kme.uiVersion","classic") ) ) {
60 viewName = "ui3/auth/index";
61 } else {
62 viewName = "auth/index";
63 }
64
65 return viewName;
66 }
67
68 @RequestMapping(value="/templates/{key}")
69 public String getAngularTemplates(
70 @PathVariable("key") String key,
71 HttpServletRequest request,
72 Model uiModel ) {
73 return "ui3/auth/templates/"+key;
74 }
75
76 @RequestMapping(value = "/js/{key}.js")
77 public String getJavaScript(
78 @PathVariable("key") String key,
79 HttpServletRequest request,
80 Model uiModel) {
81 return "ui3/auth/js/"+key;
82 }
83
84 @RequestMapping(value="logout")
85 public String logout(HttpServletRequest request, Model uiModel) {
86 return "ui3/auth/logout";
87 }
88
89 @RequestMapping(value="logoutConfirm")
90 public String logoutConfirm(HttpServletRequest request, Model uiModel) {
91 request.getSession().setAttribute(Constants.KME_MOCK_USER_KEY, null);
92 request.getSession().setAttribute(Constants.KME_USER_KEY, null);
93 return "redirect:/home";
94 }
95
96
97
98
99 public void setService(AuthService service) {
100 this.service = service;
101 }
102
103
104
105
106 public AuthService getService() {
107 return service;
108 }
109
110 public Properties getKmeProperties() {
111 return kmeProperties;
112 }
113
114 public void setKmeProperties(Properties kmeProperties) {
115 this.kmeProperties = kmeProperties;
116 }
117 }