summaryrefslogtreecommitdiffstats
path: root/portal-BE/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'portal-BE/src/main/java')
-rw-r--r--portal-BE/src/main/java/org/onap/portal/PortalApplication.java14
-rw-r--r--portal-BE/src/main/java/org/onap/portal/configuration/SecurityConfig.java54
-rw-r--r--portal-BE/src/main/java/org/onap/portal/configuration/WebMvcConfiguration.java18
-rw-r--r--portal-BE/src/main/java/org/onap/portal/controller/LoginController.java15
-rw-r--r--portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpNotification.java2
-rw-r--r--portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalog.java2
-rw-r--r--portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnApp.java2
-rw-r--r--portal-BE/src/main/java/org/onap/portal/logging/logic/EPLogUtil.java2
-rw-r--r--portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java4
9 files changed, 103 insertions, 10 deletions
diff --git a/portal-BE/src/main/java/org/onap/portal/PortalApplication.java b/portal-BE/src/main/java/org/onap/portal/PortalApplication.java
index e779744c..cf6f9d7a 100644
--- a/portal-BE/src/main/java/org/onap/portal/PortalApplication.java
+++ b/portal-BE/src/main/java/org/onap/portal/PortalApplication.java
@@ -40,14 +40,20 @@
package org.onap.portal;
+import org.apache.log4j.BasicConfigurator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.domain.EntityScan;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@SpringBootApplication
+@EntityScan("org.onap.portal.domain")
+@EnableJpaRepositories("org.onap.portal.dao")
public class PortalApplication {
- public static void main(String[] args) {
- SpringApplication.run(PortalApplication.class, args);
- }
+ public static void main(String[] args) {
+ BasicConfigurator.resetConfiguration();
+ SpringApplication.run(PortalApplication.class, args);
+ }
-}
+} \ No newline at end of file
diff --git a/portal-BE/src/main/java/org/onap/portal/configuration/SecurityConfig.java b/portal-BE/src/main/java/org/onap/portal/configuration/SecurityConfig.java
new file mode 100644
index 00000000..a6c7cbf3
--- /dev/null
+++ b/portal-BE/src/main/java/org/onap/portal/configuration/SecurityConfig.java
@@ -0,0 +1,54 @@
+package org.onap.portal.configuration;
+
+import org.onap.portal.service.fn.FnUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.crypto.password.PasswordEncoder;
+
+@Configuration
+@EnableWebSecurity
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
+ @Autowired
+ private FnUserService fnUserService;
+
+ @Override
+ protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+ auth.userDetailsService(fnUserService)
+ .passwordEncoder(new PasswordEncoder() {
+ @Override
+ public String encode(CharSequence rawPassword) {
+ return rawPassword.toString();
+ }
+
+ @Override
+ public boolean matches(CharSequence rawPassword, String encodedPassword) {
+ return true;
+ }
+ });
+ }
+
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+ http
+ .authorizeRequests()
+ .antMatchers("/static/img/**").permitAll()
+ .anyRequest().authenticated()
+ .and()
+ .formLogin()
+ .loginPage("/login")
+ .permitAll()
+ .and()
+ .logout()
+ .permitAll();
+
+ http.csrf().disable();
+ http.headers().frameOptions().disable();
+
+ }
+
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/configuration/WebMvcConfiguration.java b/portal-BE/src/main/java/org/onap/portal/configuration/WebMvcConfiguration.java
new file mode 100644
index 00000000..416c706c
--- /dev/null
+++ b/portal-BE/src/main/java/org/onap/portal/configuration/WebMvcConfiguration.java
@@ -0,0 +1,18 @@
+package org.onap.portal.configuration;
+
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.core.Ordered;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+@EnableWebMvc
+@ComponentScan("org.springframework.security.samples.mvc")
+public class WebMvcConfiguration implements WebMvcConfigurer {
+
+ @Override
+ public void addViewControllers(ViewControllerRegistry registry) {
+ registry.addViewController("login.html").setViewName("login.html");
+ registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
+ }
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/controller/LoginController.java b/portal-BE/src/main/java/org/onap/portal/controller/LoginController.java
new file mode 100644
index 00000000..e12521ba
--- /dev/null
+++ b/portal-BE/src/main/java/org/onap/portal/controller/LoginController.java
@@ -0,0 +1,15 @@
+package org.onap.portal.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+@Controller
+public class LoginController {
+
+ @RequestMapping(value = "login", method = RequestMethod.GET)
+ public String loginView() {
+ return "login";
+ }
+
+}
diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpNotification.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpNotification.java
index ab1bf73c..4fe24bd7 100644
--- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpNotification.java
+++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpNotification.java
@@ -92,7 +92,7 @@ CREATE TABLE `ep_notification` (
public class EpNotification {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name = "notification_ID", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
+ @Column(name = "notification_ID", length = 11, nullable = false)
@Digits(integer = 11, fraction = 0)
private Long notificationID;
@Column(name = "is_for_online_users", length = 1, columnDefinition = "char(1) default 'N'")
diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalog.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalog.java
index 260483f8..7bfbee8c 100644
--- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalog.java
+++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpWidgetCatalog.java
@@ -86,7 +86,7 @@ CREATE TABLE `ep_widget_catalog` (
public class EpWidgetCatalog {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name = "widget_id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
+ @Column(name = "widget_id", length = 11, nullable = false)
@Digits(integer = 11, fraction = 0)
private Long widgetId;
@Column(name = "wdg_name", length = 100, columnDefinition = "varchar(100) default '?'", nullable = false)
diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnApp.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnApp.java
index 79cc6322..84f6aea0 100644
--- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnApp.java
+++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnApp.java
@@ -120,7 +120,7 @@ public class FnApp extends DomainVo implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name = "app_Id", length = 11, nullable = false, columnDefinition = "int(11) AUTO_INCREMENT")
+ @Column(name = "app_Id", length = 11, nullable = false)
@Digits(integer = 11, fraction = 0)
private Long appId;
@Column(name = "app_name", length = 100, nullable = false, columnDefinition = "varchar(100) not null default '?'")
diff --git a/portal-BE/src/main/java/org/onap/portal/logging/logic/EPLogUtil.java b/portal-BE/src/main/java/org/onap/portal/logging/logic/EPLogUtil.java
index 719e73c9..9a3070c2 100644
--- a/portal-BE/src/main/java/org/onap/portal/logging/logic/EPLogUtil.java
+++ b/portal-BE/src/main/java/org/onap/portal/logging/logic/EPLogUtil.java
@@ -45,7 +45,7 @@ import static com.att.eelf.configuration.Configuration.MDC_ALERT_SEVERITY;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import java.text.MessageFormat;
-import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum;
+import org.onap.portal.logging.format.EPAppMessagesEnum;
import org.onap.portalsdk.core.logging.format.AlarmSeverityEnum;
import org.onap.portalsdk.core.logging.format.ErrorSeverityEnum;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
diff --git a/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java b/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java
index abc25041..91873139 100644
--- a/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java
+++ b/portal-BE/src/main/java/org/onap/portal/service/fn/FnUserService.java
@@ -54,10 +54,10 @@ import org.springframework.stereotype.Service;
@Service
public class FnUserService implements UserDetailsService {
- private final FnUserDao fnUserDao;
+ private FnUserDao fnUserDao;
@Autowired
- public FnUserService(final FnUserDao fnUserDao) {
+ public FnUserService(FnUserDao fnUserDao) {
this.fnUserDao = fnUserDao;
}