1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package fr.paris.lutece.plugins.mylutece.modules.franceconnect.web;
35
36 import fr.paris.lutece.plugins.mylutece.web.MyLuteceApp;
37 import fr.paris.lutece.portal.service.security.LuteceUser;
38 import fr.paris.lutece.portal.service.security.SecurityService;
39 import fr.paris.lutece.portal.util.mvc.commons.annotations.View;
40 import fr.paris.lutece.portal.util.mvc.xpage.MVCApplication;
41 import fr.paris.lutece.portal.util.mvc.xpage.annotations.Controller;
42 import fr.paris.lutece.portal.web.xpages.XPage;
43
44 import java.util.Map;
45
46 import javax.servlet.http.HttpServletRequest;
47
48
49
50
51
52 @Controller( xpageName = "franceconnect", pagePathI18nKey = "module.mylutece.franceconnect.loginPagePath", pageTitleI18nKey = "module.mylutece.franceconnect.loginPageTitle" )
53 public class FranceConnectApp extends MVCApplication
54 {
55
56 private static final String VIEW_HOME = "home";
57
58
59 private static final String TEMPLATE_LOGIN_PAGE = "skin/plugins/mylutece/modules/franceconnect/login_form.html";
60
61
62 private static final String MARK_USER = "user";
63 private static final String MARK_URL_DOLOGIN = "url_dologin";
64 private static final String MARK_URL_DOLOGOUT = "url_dologout";
65 private static final long serialVersionUID = 1L;
66
67
68
69
70
71
72 @View( value = VIEW_HOME, defaultView = true )
73 public XPage getHomePage( HttpServletRequest request )
74 {
75 Map<String, Object> model = getModel( );
76
77 String strError = request.getParameter( Constants.PARAMETER_ERROR );
78
79 if ( strError != null )
80 {
81 addError( strError );
82 }
83
84 LuteceUser user = SecurityService.getInstance( ).getRegisteredUser( request );
85
86 model.put( MARK_USER, user );
87 model.put( MARK_URL_DOLOGIN, MyLuteceApp.getDoLoginUrl( ) );
88 model.put( MARK_URL_DOLOGOUT, MyLuteceApp.getDoLogoutUrl( ) );
89
90 return getXPage( TEMPLATE_LOGIN_PAGE, request.getLocale( ), model );
91 }
92 }