diff --git a/security.java b/security.java new file mode 100644 index 0000000..5dd75a4 --- /dev/null +++ b/security.java @@ -0,0 +1,21 @@ +package com.example.config; + +import org.springframework.context.annotation.Configuration; +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; + +@Configuration +@EnableWebSecurity +public class SecurityConfig extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(HttpSecurity http) throws Exception { + http + .authorizeRequests() + .antMatchers("/websocket-endpoint/**").permitAll() + .anyRequest().authenticated() + .and() + .csrf().disable(); + } +} diff --git a/session.java b/session.java new file mode 100644 index 0000000..60575e4 --- /dev/null +++ b/session.java @@ -0,0 +1,16 @@ +package com.example.controller; + +import org.springframework.messaging.handler.annotation.MessageMapping; +import org.springframework.messaging.handler.annotation.SendTo; +import org.springframework.stereotype.Controller; + +@Controller +public class SessionTimeoutController { + + @MessageMapping("/check-inactivity") + @SendTo("/topic/session-timeout") + public String checkInactivity(String userId) { + // Logic to check inactivity (e.g., based on userId) + return "Session timed out due to inactivity. Please log in again."; + } +} diff --git a/webSocketConfig.java b/webSocketConfig.java index 3b298db..149f24e 100644 --- a/webSocketConfig.java +++ b/webSocketConfig.java @@ -1,24 +1,25 @@ -package websocket; - -import org.springframework.context.annotation.Configuration; -import org.springframework.messaging.simp.config.MessageBrokerRegistry; -import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker; -import org.springframework.web.socket.config.annotation.StompEndpointRegistry; -import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer; - -@Configuration -@EnableWebSocketMessageBroker -public class WebSocketConfig implements WebSocketMessageBrokerConfigurer { - - @Override - public void registerStompEndpoints(StompEndpointRegistry registry) { - registry.addEndpoint("/ws").setAllowedOrigins("ws://localhost:8082").withSockJS(); - } - - @Override - public void configureMessageBroker(MessageBrokerRegistry registry) { - registry.enableSimpleBroker("/topic"); // Enables in-memory message broker - registry.setApplicationDestinationPrefixes("/app"); // Prefix for client messages - } -} - +package com.example.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.messaging.simp.config.MessageBrokerRegistry; +import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker; +import org.springframework.web.socket.config.annotation.StompEndpointRegistry; +import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer; + +@Configuration +@EnableWebSocketMessageBroker +public class WebSocketConfig implements WebSocketMessageBrokerConfigurer { + + @Override + public void configureMessageBroker(MessageBrokerRegistry config) { + config.enableSimpleBroker("/topic"); + config.setApplicationDestinationPrefixes("/app"); + } + + @Override + public void registerStompEndpoints(StompEndpointRegistry registry) { + registry.addEndpoint("/websocket-endpoint") + .setAllowedOrigins("*") // Allow cross-origin requests from any domain + .withSockJS(); + } +} diff --git a/welcome.jsp b/welcome.jsp new file mode 100644 index 0000000..43bbda2 --- /dev/null +++ b/welcome.jsp @@ -0,0 +1,830 @@ +<%-- + Document : welcome + Created on : Apr 11, 2024, 3:49:41 PM + Author : 2552586 +--%> + + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + + + + IFSS | Home + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <% + String ModuleName = new String(); + + ModuleName = (String) session.getAttribute("moduleName"); + String role = (String) session.getAttribute("userRole"); + String pacsId = (String) session.getAttribute("pacsId"); + String holidayList = (String) session.getAttribute("holidayList"); + String kccBalanceTransfer = (String) session.getAttribute("kccBalanceTransfer"); + String broadcastMessage = (String)session.getAttribute("returnMessage"); + +// added by chhanda on 29/8/24 + String user = (String) session.getAttribute("user"); + String pacsName = (String) session.getAttribute("pacsName"); + String UserName = (String) session.getAttribute("UserName"); + String Mobile = (String) session.getAttribute("Mobile"); + + + %> + + + +
"> + + + + +
+ +
+
+
+ + Holidays +
+
    +
  • +

    <%=holidayList%> +

    +
  • +
+
+ Notifications +
+ +
    +
  • +

    Reach us: 033-4065-9546 +

    +
  • +
+
    +
  • +

    Please complete all the transaction before 31st March,2025 +

    +
  • +
+ +
    +
  • +

    Test Notification 4.

    +
  • +
+ +
    +
  • +

    Test Notification 5.

    +
  • +
+ +
    +
  • +

    Test Notification 6.

    +
  • +
+
+
+ + +
+ +
+ +
+ Dashboard +
+ +
+ +
+ +
+
+ + + + + +
+
+ + +
+ + + <% if (broadcastMessage != null && !broadcastMessage.isEmpty()) {%> + +
+ <%} else{%> + + <% }%> + + +