2 * ================================================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ================================================================================
\r
20 package org.openecomp.portalapp.controller;
\r
22 import java.util.HashMap;
\r
23 import java.util.Map;
\r
25 import javax.servlet.http.HttpServletRequest;
\r
26 import javax.servlet.http.HttpServletResponse;
\r
28 import org.openecomp.portalsdk.core.auth.LoginStrategy;
\r
29 import org.openecomp.portalsdk.core.controller.UnRestrictedBaseController;
\r
30 import org.openecomp.portalsdk.core.onboarding.listener.PortalTimeoutHandler;
\r
31 import org.openecomp.portalsdk.core.service.LoginService;
\r
32 import org.openecomp.portalsdk.core.service.ProfileService;
\r
33 import org.openecomp.portalsdk.core.web.support.AppUtils;
\r
34 import org.springframework.beans.factory.annotation.Autowired;
\r
35 import org.springframework.stereotype.Controller;
\r
36 import org.springframework.web.bind.annotation.RequestMapping;
\r
37 import org.springframework.web.bind.annotation.RequestMethod;
\r
38 import org.springframework.web.servlet.ModelAndView;
\r
41 @RequestMapping("/")
\r
42 public class ONAPLoginController extends UnRestrictedBaseController {
\r
44 ProfileService service;
\r
46 private LoginService loginService;
\r
48 private LoginStrategy loginStrategy;
\r
51 @RequestMapping(value = { "/doLogin" }, method = RequestMethod.GET)
\r
52 public ModelAndView doLogin(HttpServletRequest request, HttpServletResponse response) throws Exception {
\r
53 return loginStrategy.doLogin(request, response);
\r
56 public String getJessionId(HttpServletRequest request) {
\r
57 return request.getSession().getId();
\r
60 protected void initateSessionMgtHandler(HttpServletRequest request) {
\r
61 String jSessionId = getJessionId(request);
\r
62 PortalTimeoutHandler.sessionCreated(jSessionId, jSessionId, AppUtils.getSession(request));
\r
65 public String getViewName() {
\r
69 public void setViewName(String viewName) {
\r
70 this.viewName = viewName;
\r
73 public LoginService getLoginService() {
\r
74 return loginService;
\r
77 public void setLoginService(LoginService loginService) {
\r
78 this.loginService = loginService;
\r