Skip to content

Commit

Permalink
chore: implement e-signet links
Browse files Browse the repository at this point in the history
  • Loading branch information
tahmidrahman-dsi committed Jan 8, 2025
1 parent e5d3432 commit a67dde2
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 61 deletions.
4 changes: 4 additions & 0 deletions infrastructure/docker-compose.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,10 @@ services:
- INFOBIP_API_KEY=${INFOBIP_API_KEY:-}
- INFOBIP_SENDER_ID=${INFOBIP_SENDER_ID:-}
- DOMAIN={{hostname}}
- E_SIGNET_AUTH_URL=${E_SIGNET_AUTH_URL}
- OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID}
- OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS}
- OIDP_USER_INFO_URL=${OIDP_USER_INFO_URL}
networks:
- overlay_net
logging:
Expand Down
4 changes: 4 additions & 0 deletions infrastructure/docker-compose.development-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ services:
- SMTP_USERNAME=${SMTP_USERNAME}
- SMTP_PASSWORD=${SMTP_PASSWORD}
- SMTP_SECURE=${SMTP_SECURE}
- E_SIGNET_AUTH_URL=${E_SIGNET_AUTH_URL}
- OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID}
- OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS}
- OIDP_USER_INFO_URL=${OIDP_USER_INFO_URL}
deploy:
replicas: 1
networks:
Expand Down
4 changes: 4 additions & 0 deletions infrastructure/docker-compose.qa-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ services:
- SMTP_USERNAME=${SMTP_USERNAME}
- SMTP_PASSWORD=${SMTP_PASSWORD}
- SMTP_SECURE=${SMTP_SECURE}
- E_SIGNET_AUTH_URL=${E_SIGNET_AUTH_URL}
- OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID}
- OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS}
- OIDP_USER_INFO_URL=${OIDP_USER_INFO_URL}
deploy:
replicas: 1
networks:
Expand Down
4 changes: 4 additions & 0 deletions infrastructure/docker-compose.staging-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ services:
- SMTP_USERNAME=${SMTP_USERNAME}
- SMTP_PASSWORD=${SMTP_PASSWORD}
- SMTP_SECURE=${SMTP_SECURE}
- E_SIGNET_AUTH_URL=${E_SIGNET_AUTH_URL}
- OPENID_PROVIDER_CLIENT_ID=${OPENID_PROVIDER_CLIENT_ID}
- OPENID_PROVIDER_CLAIMS=${OPENID_PROVIDER_CLAIMS}
- OIDP_USER_INFO_URL=${OIDP_USER_INFO_URL}
deploy:
replicas: 1

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@hapi/boom": "^9.1.1",
"@hapi/hapi": "^20.0.1",
"@hapi/inert": "^6.0.3",
"@opencrvs/mosip": "^1.7.0-alpha.2",
"@opencrvs/mosip": "^1.7.0-alpha.4",
"@opencrvs/toolkit": "0.0.6-events",
"@types/chalk": "^2.2.0",
"@types/csv2json": "^1.4.0",
Expand Down
6 changes: 6 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ export const CHECK_INVALID_TOKEN = env.CHECK_INVALID_TOKEN

export const PRODUCTION = env.isProd
export const QA_ENV = env.QA_ENV

// e-signet
export const E_SIGNET_AUTH_URL = env.E_SIGNET_AUTH_URL
export const OPENID_PROVIDER_CLIENT_ID = env.OPENID_PROVIDER_CLIENT_ID
export const OPENID_PROVIDER_CLAIMS = env.OPENID_PROVIDER_CLAIMS
export const OIDP_USER_INFO_URL = env.OIDP_USER_INFO_URL
6 changes: 5 additions & 1 deletion src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,9 @@ export const env = cleanEnv(process.env, {
CONFIRM_REGISTRATION_URL: url({
devDefault: 'http://localhost:5050/confirm/registration'
}),
QA_ENV: bool({ default: false })
QA_ENV: bool({ default: false }),
E_SIGNET_AUTH_URL: url({ devDefault: '' }),
OPENID_PROVIDER_CLIENT_ID: str({ devDefault: '' }),
OPENID_PROVIDER_CLAIMS: str({ devDefault: '' }),
OIDP_USER_INFO_URL: url({ devDefault: '' })
})
89 changes: 36 additions & 53 deletions src/form/birth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
*/

import { Event, ISerializedForm } from '../types/types'
import { Event, ISerializedForm, SerializedFormField } from '../types/types'
import { formMessageDescriptors } from '../common/messages'
import { informantType } from './required-fields'
import {
Expand Down Expand Up @@ -79,7 +79,20 @@ import { getSectionMapping } from '@countryconfig/utils/mapping/section/birth/ma
import { getCommonSectionMapping } from '@countryconfig/utils/mapping/field-mapping-utils'
import { getReasonForLateRegistration } from '../custom-fields'
import { getIDNumberFields, getIDType } from '../custom-fields'
import { getGenderCustom, getIDReaderField } from './custom-fields'
import {
esignet,
esignetCallback,
idReader,
idVerificationFields,
qr
} from '@opencrvs/mosip'
import { getGenderCustom } from './custom-fields'
import {
E_SIGNET_AUTH_URL,
OIDP_USER_INFO_URL,
OPENID_PROVIDER_CLAIMS,
OPENID_PROVIDER_CLIENT_ID
} from '@countryconfig/constants'
// import { createCustomFieldExample } from '../custom-fields'

// ======================= FORM CONFIGURATION =======================
Expand Down Expand Up @@ -220,65 +233,35 @@ export const birthForm: ISerializedForm = {
fields: [
informantType, // Required field.
otherInformantType(Event.Birth), // Required field.
getIDReaderField(
idReader(
'birth',
'informant',
informantFirstNameConditionals
.concat(hideIfInformantMotherOrFather)
.concat({
action: 'hide',
expression: '!!$form?.verified'
})
),
{
name: 'someHTTPField',
type: 'HTTP',
custom: true,
label: {
id: 'messages.empty',
defaultMessage: ' '
},
validator: [],
options: {
url: 'someRoute',
headers: {
'Content-type': 'application/json'
},
method: 'GET'
}
},
{
name: 'verified',
type: 'HIDDEN',
custom: true,
label: {
id: 'messages.empty',
defaultMessage: ''
},
initialValue: {
dependsOn: ['idReader'],
expression: 'Boolean($form?.idReader)? "pending":""'
},
validator: []
},
{
name: 'idPending',
type: 'ID_VERIFICATION_BANNER',
custom: true,
bannerType: 'pending',
idFieldName: 'idReader',
label: {
id: 'messages.empty',
defaultMessage: ''
},
validator: [],
conditionals: [
{
action: 'hide',
expression: '$form?.verified !== "pending"'
}
}),
[
qr(),
esignet(
E_SIGNET_AUTH_URL,
OPENID_PROVIDER_CLIENT_ID,
OPENID_PROVIDER_CLAIMS,
'esignet',
'esignetCallback'
)
]
},
) as SerializedFormField,
esignetCallback({
fieldName: 'esignetCallback',
getOIDPUserInfoUrl: OIDP_USER_INFO_URL,
openIdProviderClientId: OPENID_PROVIDER_CLIENT_ID
}) as SerializedFormField,
...(idVerificationFields(
'birth',
'informant'
) as SerializedFormField[]),
getFirstNameField(
'informantNameInEnglish',
informantFirstNameConditionals.concat(
Expand Down
10 changes: 4 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -790,12 +790,10 @@
dependencies:
"@octokit/openapi-types" "^18.0.0"

"@opencrvs/mosip@^1.7.0-alpha.2":
version "1.7.0-alpha.2"
resolved "https://registry.yarnpkg.com/@opencrvs/mosip/-/mosip-1.7.0-alpha.2.tgz#b3de70d993607142d739c7ada0c021b0d0f32b46"
integrity sha512-UiZUxuUiNGP/9CuQh1yPtmXmZTRAFiY4jQI2qlihCXZ8A0JbdXut2g3Dw3dRNvA9SvUnix1uuQpmWU/tAePWJA==
dependencies:
"@hapi/hapi" "^20.0.1"
"@opencrvs/mosip@^1.7.0-alpha.4":
version "1.7.0-alpha.4"
resolved "https://registry.yarnpkg.com/@opencrvs/mosip/-/mosip-1.7.0-alpha.4.tgz#82bd22e6dfbebfced533343774825da9ec194289"
integrity sha512-INdAXQWpdZ4y04MDhZd5cYl4pTl1FvrQfyWn4P8nqukAh/JpW8UtZE98zoIJ7/wS331zO6Lj5w0th+baGgQu/A==

"@opencrvs/toolkit@0.0.6-events":
version "0.0.6-events"
Expand Down

0 comments on commit a67dde2

Please sign in to comment.