Skip to content

Commit

Permalink
Updated code
Browse files Browse the repository at this point in the history
Signed-off-by: Aiham <aiham.hasan@mindtree.com>
  • Loading branch information
aihamh committed Jun 25, 2024
1 parent 6f1e3a7 commit ce6ac10
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 29 deletions.
10 changes: 5 additions & 5 deletions pre-registration-booking-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ ARG container_user=mosip
ARG container_user_group=mosip

# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user_uid=1001
ARG container_user_uid=1002

# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user_gid=1001

# install packages and create user
RUN apt-get -y update \
&& apt-get install -y unzip \
&& groupadd -g ${container_user_gid} ${container_user_group} \
&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user}
RUN apk -q update \
&& apk add -q unzip wget \
&& addgroup -g ${container_user_gid} ${container_user_group} \
&& adduser -s /bin/sh -u ${container_user_uid} -G ${container_user_group} -h /home/${container_user} --disabled-password ${container_user}

# set working directory for the user
WORKDIR /home/${container_user}
Expand Down
19 changes: 18 additions & 1 deletion pre-registration-booking-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,19 @@
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
</dependencies>


Expand All @@ -272,7 +285,11 @@
<skipTests>${skipTests}</skipTests>
<skip>false</skip>
<argLine>
${argLine} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --illegal-access=permit
${argLine}
--add-opens java.xml/jdk.xml.internal=ALL-UNNAMED
--add-opens java.base/java.lang=ALL-UNNAMED
--illegal-access=debug
--enable-preview
</argLine>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import java.time.LocalDate;
import java.time.LocalTime;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;

import lombok.Getter;
import lombok.Setter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
import java.time.LocalDateTime;
import java.time.LocalTime;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import jakarta.persistence.AttributeOverride;
import jakarta.persistence.AttributeOverrides;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.IdClass;
import jakarta.persistence.NamedQuery;
import jakarta.persistence.Table;

import org.springframework.stereotype.Component;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.List;

import javax.transaction.Transactional;
import javax.persistence.LockModeType;
import jakarta.persistence.LockModeType;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.Lock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import java.util.TreeMap;
import java.util.stream.Collectors;

import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;

import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.Map;
import java.util.TimeZone;

import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@

import javax.net.ssl.SSLContext;

import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder;
import org.apache.hc.client5.http.io.HttpClientConnectionManager;
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
import org.apache.http.ssl.TrustStrategy;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -29,8 +31,11 @@ public RestTemplate selfTokenRestTemplate()

SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext);

CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(csf).build();
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
HttpClientConnectionManager connectionManager = PoolingHttpClientConnectionManagerBuilder.create()
.setSSLSocketFactory(csf).build();
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(connectionManager).build();
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();


requestFactory.setHttpClient(httpClient);
return new RestTemplate(requestFactory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// import java.util.Arrays;
// import java.util.List;

// import javax.servlet.http.HttpServletResponse;
// import jakarta.servlet.http.HttpServletResponse;

// import org.springframework.context.annotation.Bean;
// import org.springframework.context.annotation.Configuration;
Expand All @@ -27,7 +27,8 @@
// @EnableWebSecurity
// @EnableGlobalMethodSecurity(prePostEnabled = true)
// @Order(2)
// public class TestSecurityConfig extends WebSecurityConfigurerAdapter {
// @EnableMethodSecurity
// public class TestSecurityConfig @EnableGlobalMethodSecurity(prePostEnabled = true){



Expand Down Expand Up @@ -63,6 +64,11 @@
// return (request, response, authException) -> response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
// }

// @Bean
// protected SecurityFilterChain configureSecurityFilterChain(final HttpSecurity httpSecurity) throws Exception {
// return httpSecurity.build();
// }

// @Bean
// public UserDetailsService userDetailsService() {
// List<UserDetails> users = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,6 @@ mosip.iam.adapter.clientid=mosip-prereg-client
mosip.iam.adapter.clientsecret=abc123
mosip.iam.adapter.appid=prereg
# URL to get new Auth Token from OIDC provider & to do online validation of auth token with OIDC provider.
auth.server.admin.issuer.uri=https://dev.mosip.net/keycloak/auth/realms/
auth.server.admin.issuer.uri=https://dev.mosip.net/keycloak/auth/realms/

spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER

0 comments on commit ce6ac10

Please sign in to comment.