Skip to content

Commit

Permalink
Merge branch 'mosip:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Sairam-g9162 authored Dec 19, 2024
2 parents e713ecc + 6276e95 commit d398411
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 67 deletions.
4 changes: 2 additions & 2 deletions docker-compose/config/mimoto-default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ mosip.inji.minStorageRequired=2

# START bootstrap.properties

spring.cloud.config.uri=http://nginx/
spring.cloud.config.uri=http://inji-web:3004/
spring.cloud.config.name=mimoto,inji
spring.application.name=mimoto

#config.server.file.storage.uri=https://raw.githubusercontent.com/mosip/mosip-config/collab1/
config.server.file.storage.uri=http://nginx/
config.server.file.storage.uri=http://inji-web:3004/

management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=info,health,refresh
Expand Down
22 changes: 13 additions & 9 deletions docker-compose/config/mimoto-issuers-config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"issuers": [
{
"credential_issuer": "Mosip",
"issuer_id": "Mosip",
"protocol": "OpenId4VCI",
"display": [
{
Expand Down Expand Up @@ -72,11 +72,13 @@
"proxy_token_endpoint": "https://esignet-mosipid.collab.mosip.net/v1/esignet/oauth/v2/token",
"client_alias": "mpartner-default-test-mosipid",
"qr_code_type": "OnlineSharing",
"enabled": "true",
"wellknown_endpoint": "https://injicertify-mosipid.collab.mosip.net/v1/certify/issuance/.well-known/openid-credential-issuer"
"wellknown_endpoint": "https://injicertify-mosipid.collab.mosip.net/v1/certify/issuance/.well-known/openid-credential-issuer",
"credential_issuer": "https://injicertify-mosipid.collab.mosip.net",
"enabled": "true"

},
{
"credential_issuer": "StayProtected",
"issuer_id": "StayProtected",
"protocol": "OpenId4VCI",
"display": [
{
Expand All @@ -97,11 +99,12 @@
"proxy_token_endpoint": "https://esignet-insurance.dev1.mosip.net/v1/esignet/oauth/v2/token",
"client_alias": "esignet-sunbird-partner",
"qr_code_type": "OnlineSharing",
"enabled": "true",
"wellknown_endpoint": "https://injicertify-insurance.dev1.mosip.net/v1/certify/issuance/.well-known/openid-credential-issuer"
"wellknown_endpoint": "https://injicertify-insurance.dev1.mosip.net/v1/certify/issuance/.well-known/openid-credential-issuer",
"credential_issuer": "https://injicertify-insurance.dev1.mosip.net",
"enabled": "true"
},
{
"credential_issuer": "Mock",
"issuer_id": "Mock",
"protocol": "OpenId4VCI",
"display": [
{
Expand All @@ -122,8 +125,9 @@
"proxy_token_endpoint": "https://esignet-mock.collab.mosip.net/v1/esignet/oauth/v2/token",
"client_alias": "mpartner-mock-testing",
"qr_code_type": "OnlineSharing",
"enabled": "true",
"wellknown_endpoint": "https://injicertify-mock.collab.mosip.net/v1/certify/issuance/.well-known/openid-credential-issuer"
"wellknown_endpoint": "https://injicertify-mock.collab.mosip.net/v1/certify/issuance/.well-known/openid-credential-issuer",
"credential_issuer": "https://injicertify-mock.collab.mosip.net",
"enabled": "true"
}
]
}
37 changes: 7 additions & 30 deletions docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
version: '3.8'

services:
nginx:
container_name: nginx
image: nginx:alpine
ports:
- '80:80'
volumes:
- ./config/mimoto-issuers-config.json:/config/server/mimoto-issuers-config.json
- ./config/mimoto-trusted-verifiers.json:/config/server/mimoto-trusted-verifiers.json
- ./config/credential-template.html:/config/server/credential-template.html
- ./nginx.conf:/etc/nginx/nginx.conf

mimoto-service:
container_name: 'mimoto-service'
Expand All @@ -25,32 +15,19 @@ services:
- SPRING_CONFIG_LOCATION=/home/mosip/
volumes:
- ./config/mimoto-default.properties:/home/mosip/mimoto-default.properties
- ./config/mimoto-issuers-config.json:/home/mosip/mimoto-issuers-config.json
- ./config/mimoto-trusted-verifiers.json:/home/mosip/mimoto-trusted-verifiers.json
- ./certs/oidckeystore.p12:/home/mosip/certs/oidckeystore.p12
depends_on:
- nginx

inji-web-proxy:
container_name: 'inji-web-proxy'
image: inji-web-proxy:local
ports:
- '3010:3010'
environment:
- MIMOTO_HOST=http://mimoto-service:8099/v1/mimoto
- PORT=3010
depends_on:
- mimoto-service

inji-web:
container_name: 'inji-web'
image: inji-web:local
ports:
- '3001:3004'
- '3004:3004'
environment:
- DEFAULT_LANG=en
- MIMOTO_HOST=http://localhost:3010
- MIMOTO_HOST=http://localhost:3004/v1/mimoto
volumes:
- ./config/mimoto-default.properties:/home/mosip/mimoto-default.properties
- ./config/mimoto-issuers-config.json:/home/mosip/mimoto-issuers-config.json
- ./config/mimoto-trusted-verifiers.json:/home/mosip/mimoto-trusted-verifiers.json
depends_on:
- inji-web-proxy


- mimoto-service
12 changes: 0 additions & 12 deletions docker-compose/nginx.conf

This file was deleted.

32 changes: 28 additions & 4 deletions inji-web/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
server {
listen 3004;
# Serve static files, if any
# Default location for normal static files
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}


location /mimoto/ {
proxy_pass http://192.168.2.186:8089/;
# Serve files from /home/mosip with autoindex enabled
location ~* \.json$ {
root /home/mosip;
autoindex on;
}


# Proxy API requests to mimoto-service
location /v1/mimoto/ {
proxy_pass http://mimoto-service:8099/v1/mimoto/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Connection "";

# Add CORS headers
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, Cache-Control' always;

# Handle OPTIONS requests (for pre-flight checks)
if ($request_method = 'OPTIONS') {
return 204;
}
}

error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /usr/share/nginx/html;
root /usr/share/nginx/html;
}
}
4 changes: 2 additions & 2 deletions inji-web/src/__tests__/pages/RedirectionPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('Testing the Layout of RedirectionPage', () => {
mockUseFetch();
test('Check if the layout is matching with the snapshots', () => {
mockUseFetchhook.mockReturnValue({ state: 'DONE', fetchRequest: jest.fn() });
(getActiveSession as jest.Mock).mockReturnValue({ selectedIssuer: { credential_issuer: 'issuer1', display: [{ name: 'Test Issuer' }] } });
(getActiveSession as jest.Mock).mockReturnValue({ selectedIssuer: { issuer_id: 'issuer1', display: [{ name: 'Test Issuer' }] } });
const { asFragment } = renderWithRouter(<RedirectionPage />);
expect(asFragment()).toMatchSnapshot();
});
Expand All @@ -33,7 +33,7 @@ describe('Testing the Functionality of RedirectionPage', () => {
mockusei18n();
mockUseFetch();
jest.clearAllMocks();
(getActiveSession as jest.Mock).mockReturnValue({ selectedIssuer: { credential_issuer: 'issuer1', display: [{ name: 'Test Issuer' }] } });
(getActiveSession as jest.Mock).mockReturnValue({ selectedIssuer: { issuer_id: 'issuer1', display: [{ name: 'Test Issuer' }] } });
});

test('Check if NavBar component is rendered', () => {
Expand Down
2 changes: 1 addition & 1 deletion inji-web/src/__tests__/utils/api.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('Testing API Class', () => {
name: 'Issuer Name',
desc: 'Issuer Description',
protocol: 'OpenId4VCI',
credential_issuer: 'issuer123',
issuer_id: 'issuer123',
authorization_endpoint: 'http://auth.server/authorize',
credentials_endpoint: 'http://credentials.endpoint',
display: [
Expand Down
2 changes: 1 addition & 1 deletion inji-web/src/components/Issuers/Issuer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const Issuer: React.FC<IssuerProps> = ({issuer, index}) => {
url={issuerDisplayObject?.logo.url}
title={issuerDisplayObject?.name}
description={issuerDisplayObject?.description}
onClick={() => navigate(`/issuers/${issuer.credential_issuer}`)}/>
onClick={() => navigate(`/issuers/${issuer.issuer_id}`)}/>
</React.Fragment>
}

4 changes: 2 additions & 2 deletions inji-web/src/pages/RedirectionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const RedirectionPage: React.FC = () => {
const code = searchParams.get("code") ?? "";
const urlState = searchParams.get("state") ?? "";
const codeVerifier = activeSessionInfo?.codeVerifier;
const issuerId = activeSessionInfo?.selectedIssuer?.credential_issuer ?? "";
const issuerId = activeSessionInfo?.selectedIssuer?.issuer_id ?? "";
const certificateId = activeSessionInfo?.certificateId;
const vcStorageExpiryLimitInTimes = activeSessionInfo?.vcStorageExpiryLimitInTimes ?? "-1";

Expand Down Expand Up @@ -87,7 +87,7 @@ export const RedirectionPage: React.FC = () => {
}

return <div data-testid="Redirection-Page-Container">
{activeSessionInfo?.selectedIssuer?.credential_issuer && <NavBar title={displayObject?.name ?? ""} search={false} link={`/issuers/${activeSessionInfo?.selectedIssuer?.credential_issuer}`}/>}
{activeSessionInfo?.selectedIssuer?.issuer_id && <NavBar title={displayObject?.name ?? ""} search={false} link={`/issuers/${activeSessionInfo?.selectedIssuer?.issuer_id}`}/>}
{loadStatusOfRedirection()}
</div>
}
6 changes: 3 additions & 3 deletions inji-web/src/test-utils/mockObjects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export const mockIssuerObject = {
name: 'Test Issuer',
desc: 'Test Description',
protocol: 'OTP' as 'OTP', // Explicitly set the type to 'OTP' or 'OpenId4VCI'
credential_issuer: 'test-issuer',
issuer_id: 'test-issuer',
authorization_endpoint: 'https://auth.test.com',
credentials_endpoint: 'https://credentials.test.com',
display: [{
Expand Down Expand Up @@ -154,7 +154,7 @@ export const mockIssuerObjectList = [
name: 'Issuer 1',
desc: 'Description 1',
protocol: 'OpenId4VCI',
credential_issuer: 'issuer1',
issuer_id: 'issuer1',
authorization_endpoint: 'https://issuer1.com/auth',
credentials_endpoint: 'https://issuer1.com/credentials',
display: [
Expand All @@ -179,7 +179,7 @@ export const mockIssuerObjectList = [
name: 'Issuer 2',
desc: 'Description 2',
protocol: 'OpenId4VCI',
credential_issuer: 'issuer2',
issuer_id: 'issuer2',
authorization_endpoint: 'https://issuer2.com/auth',
credentials_endpoint: 'https://issuer2.com/credentials',
display: [
Expand Down
2 changes: 1 addition & 1 deletion inji-web/src/types/data.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export type IssuerObject = {
name: string;
desc: string;
protocol: 'OTP' | 'OpenId4VCI';
credential_issuer: string,
issuer_id: string,
authorization_endpoint: string;
credentials_endpoint: string;
display: DisplayArrayObject[];
Expand Down

0 comments on commit d398411

Please sign in to comment.