Structuring File Connector files and directory
Overview:
In this document, we will walk-through the steps for setting up connection with your Application to IDHub into your dedicated environment using File connector, This file will be deployed in the server where the onboarding application is running. The File connector applications serves as a bridge between the onboarding application and IDHUB for information flow
Before starting the establishing of connection, few things needs to be checked/ done (for completion) as below:
- List of Fields present in your application
- Administrator credentials for logging into the application
- Directory structure with right folders
- Extract File connector application Zip File, from downloaded IDHUB website from here
Detailed steps for each one of the above steps are provided below
Setup Step 1: Know your Field lists
The first step of setting up File connector application Application into IDHub is knowing what fields you will need to make seamless connection establishment
Why is it required?
This is required so that:
- Whenever there is a access request by any of the users in IDHub, an account gets created automatically for the requester upon successful approval
- The created account will contain all the mapped fields correctly and users will have a seamless experience to go and use the application
How to know your field
Typically the fields are the general information used to register someone/something with unique information to itself :
- Some standard way of checking fields may be considered as what information do we capture in order to register a new user to any application, few examples of fields are as below
FirstName - Specifies the name of the form
Address - Specifies the address of the user
_id - Specifies the identifier of the form, etc - Here is an example on how you checked the fields
Setup Step 2: Your Administrator Credentials
The second step of setting up File Connector Application into IDHub is getting valid credentials to login to your application as an administrator
Why is it required?
This is required so IDHUB application can make changes into your database and application for automatic, fast and best user experience
What are the different types of Authentication mechanism?
User authentication is a method that keeps unauthorized users from accessing sensitive information. For example, User A only has access to relevant information and cannot see the sensitive information of User B
The list below reviews some common authentication methods used to secure modern systems
Token-based authentication
Password-based authentication
Multi-factor authentication
Certificate-based authentication
Biometric authentication
In this particular implementation we choose to have Token based Oauth2
OAuth doesn't share password data but instead uses authorization tokens to prove an identity between consumers and service providers. OAuth is an authentication protocol that allows you to approve one application interacting with another on your behalf without giving away your password
This way no one from the frontend requires to give secure protocol passwords to anyone and can be carried out by token based authentication
How will IDHub use your credentials?
IDHUB doesn't share password data but instead uses authorisation tokens to prove an identity between consumers and service providers, for this purpose we require a administrator credentials to make necessary changes in the required fields
Setup Step 3: Make your directory structure
The directory structure is supposed to be on the server where the onboarding application is running
How to make the structure?
To achieve above configuration directory structure follow the below command list in terminal:
cd / - takes you to the home directory of the server
mkdir command- used to create directory
cd /
mkdir /idhubfileconnector
mkdir /idhubfileconnector/configurations
mkdir /idhubfileconnector/configurations/scim
mkdir /idhubfileconnector/configurations/schemas
How does an ideal Directory structure look like?
After you have ran all the commands below is the type of directory you will be looking into:
/idhubfileconnector/
/idhubfileconnector/configurations
/idhubfileconnector/configurations/scim
/idhubfileconnector/configurations/schemas
Setup Step 4: Extract File connector zip Files
How to get the zip File?
- It will available to download from the website - If you want to understand how to download - Go here
After you download the installation package and extract it, the file is available as Text File-connector.zip - End Goal - We have all the zip File to update and complete connection establishment with the application
Setup Step 5: Changing Configuration Files
There are 4 files that needs changes based on the information procured above.
- ServiceProviderConfig.json (This file will be only be changed by the service provider)
- application.yml
- splice.yml
- Account.json (This file needs to be changed as per different resource)
Detailed steps for each one of the above steps are provided below
ServiceProviderConfig.json
Service Provider configuration json file is the place to define the scope of what IDHUB connector can support and some metadata related to the connector
Where is the file?
The directory structure for ServiceProviderConfig.json file in the idhubfileconnector folder would be
/idhubfileconnector/configurations/scim/ServiceProviderConfig.json
What changes to make?
Only the service provide i.e from the IDHUB development team will be changing this file configurations
How does the end output look like?
This files end output will look as below
{
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig"
],
"documentationUri": "https://www.sath.com/idhub/documentation",
"patch": {
"supported": false
},
"bulk": {
"supported": false,
"maxOperations": 0,
"maxPayloadSize": 0
},
"filter": {
"supported": false,
"maxResults": 0
},
"changePassword": {
"supported": false
},
"sort": {
"supported": false
},
"etag": {
"supported": false
},
"authenticationSchemes": [
{
"name": "OAuth Bearer Token",
"description": "Authentication scheme using the OAuth Bearer Token Standard",
"specUri": "http://www.rfc-editor.org/info/rfc6750",
"documentationUri": "no documentation",
"type": "oauthbearertoken",
"primary": true
},
{
"name": "HTTP Basic",
"description": "Authentication scheme using the HTTP Basic Standard",
"specUri": "http://www.rfc-editor.org/info/rfc2617",
"documentationUri": "no documentation",
"type": "httpbasic"
}
],
"meta": {
"location": "scim/v2/ServiceProviderConfig",
"resourceType": "ServiceProviderConfig",
"created": "2019-09-03T00:00:00Z",
"lastModified": "2019-09-03T00:00:00Z",
"version": "W\/\"3694e05e9dff594\""
}
}
Where to place the updated file?
This file will be placed under the same folder location
/idhubfileconnector/configurations/scim/ServiceProviderConfig.json
Application.yml
This YAML file has Core Compatibility version, IDHUB services and security configurations
Where is the file?
The directory structure for application.yml file in the File-connector folder would be
/idhubfileconnector/configurations/application.yml
Where to get data for changes?
The Url will basically remain the same, except the DNS name will change every time
access token needs to be generated, details are Explained in the later section of the Documentation "Generate access token"
What changes to make?
Field Name | Field Description | Field Type | Sample Values |
---|---|---|---|
access-token-uri | Authorization engine url for keycloak/etc where the connector is deployed,replace <> which the server DNS where the connector is deployed, rest remains the same | URL | https://abc.com/auth/realms/protocol/openid-connect/token |
idhub-core url: | Application base URL Only the domain name needs to be changed under <> where the connector is deployed, rest remains the same | URL | https://<abc.com>/api/core |
jwk-set-uri: | certs URL for the DNS replace <> which the server DNS where the connector is deployed, rest remains the same | URL | https://<abc.com>/auth/realms/IDHub/protocol/openid-connect/certs |
server port: | Port where the application is running | Numeric | 8805 |
security | access-token: This will be generated through any post API response generator by passing header and body | Alphanumeric | b29cxxxx-4exx-xx37-aa16-e5xx-2xxxxxxx b2e5cxx-4exx-xx37-aa16-e5c52xxxxxxx b29cxxxx-4exx-xxxx--aa16-e5c52xxxxxxx |
How does the end output look like?
This files end output will look as below
info:
app:
name: Connector API Application
description: IDHUB Connector Application
version: 1.0.0
compatible-core-version: 1.0
management:
endpoints:
web:
exposure:
include: info,health,httptrace
idhub-core:
url: https://abc.com/api/core
target-system:
name: <File>
server:
port: 8805
spring:
security:
oauth2:
resourceserver:
jwt:
jwk-set-uri: "https://<abc.com>/auth/realms/IDHub/protocol/openid-connect/certs"
client:
client-id: Connector
access-token-uri : https://<abc.com>/auth/realms/IDHub/protocol/openid-connect/token
tenant-name: example-92202
access-token: <eyJhbGciOiJSUzI1NiIsInR5cCIg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27jJT1f_l8d8R_JUndHzAE1qCmt9N_bFqLAj3p6jXmfjkOskhKIMCQcFG4VbeocRqUmt9Xrc8OUotlDXvhrIczpABVvLKHaMf912DABT8FoPHqoMAIU3yzB49tg>
Where to place the updated file?
This file will be placed under the same folder location
/idhubfileconnector/configurations/application.yml
Splice.yml
This YAML file has an File based Application connection details
Where is the file?
The directory structure for Splice.yml file in the File-connector folder would be
/idhubFileconnector/configurations/splice.yml
Where to get data for changes?
The data will be from application specific which needs to be onboarded
The hostname/IP of the application
username and password to login to the application
What changes to make?
Field Name | Field Description | Field Type | Sample Values |
---|---|---|---|
environment | type of environment, it can be test, production, development etc | Alphabetical | test |
hostname/IP | Host name or ip address for the application | Alphabetical/Numeric | gmail.com/10.2.0.0 |
username | Username for the application to login | Alphabetical | Alphabetical |
**password | Username for the application to login | Alphanumeric | rt3cxxxx-5exx-xx89-aa16-t6hju7xxxxxx |
**Password: How to create ?
Step1: Go to the website https://www.devglan.com/online-tools/jasypt-online-encryption-decryption
This is to ensure that the password generated will be encrypted and cannot be used by anyone to misuse hence we defined a separate out of the application password generation tool
Step2: Enter your password in plain text to encrypt text box
Step3: Type of encryption as "Two way encryption"
Step4: In place of secret key use "8598298e-395e-47d9-a0eb-b04242119c24" and encrypt your password
Step5: Copy the encrypted string value to the password section in the splice.yml file
How does the end output look like?
This files end output will look as below
spring:
profile: splice
name: File-splice
environment: <test>
version: splice-version
target-system:
name: <file>
host: <hostname/IP>
port: 389
username: cn=<Directory Manager>
password: <rt3cxxxx-5exx-xx89-aa16-t6hju7xxxxxx>
searchbase: dc=iamsath,dc=com
newuserbase:
Where to place the updated file?
This file will be placed under the same folder location
/idhubFileconnector/configurations/splice.yml
Resource Configuration
All resource-specific configuration is kept under under this file
There is one file for each type of resource
For example for resource Account, there will be a file Account.json
And here we are configuring Account.json file below
Where is the file?
The directory structure for Account.json file in the File-connector folder would be
/idhubfileconnector/configurations/schemas/Account.json
Where to get data for changes?
The changes are all application and database structure related which needs to be defined in order to insert, delete and modify data into the application database
What changes to make?
Each resource file will have a JSON object with the following attributes:
id:
id of the resource in a specific format "urn:sath:params:scim:schemas:core:<compatible version number>:<Resource Name>"
name:
Resource name as string i.e Account
description:
Description of the resource as a string
attributes:
An array of JSON Object for different Resource specific attributes of IDHUB system.
Each object will have 3 attributes
name
as string
type
as string
required
as boolean
meta
This is a JSON object which has 2 attributes. This doesn't need to change until asked by the Service provider on IDHUB new version release.
resourceType
location
schema
Same as id attribute
matching-attributes
This is a list of attribute names which will be used by splice to determine unique resource in the csv file.
i.e.
"matching-attributes": [
"UserLogin"
]
attribute-map
This is a mapping of the IDHUB Resource attribute with the TargetSystem Resource corresponding attribute.
"attribute-map": {
"<TargetSystem Attribute Name>": {
"type": "string",
"attribute": "<IDHUB Attribute Name>"
},
......
}
Check the sample below.
configs
This is a JSON object which holds table-specific config for inserting, updating, and searching resource.
uniqueKey:
This is a unique key attribute in the File to uniquely identify IDHUB user/account
"configs": {
"uniqueKey":"username",
}
How does the end output look like?
Check the sample as the final output for Account Resource schema and will be saved as Account.json file
{
"id": "urn:sath:params:scim:schemas:core:1.0:Account",
"name": "Account",
"description": "User Account",
"schemas": "urn:sath:params:scim:schemas:core:1.0:Account",
"attributes": [
{
"name": "email",
"type": "string",
"required": true
},
{
"name": "fullName",
"type": "string",
"required": false
},
{
"name": "phone",
"type": "string",
"required": false
},
{
"name": "UserLogin",
"type": "string",
"required": true
},
{
"name": "entitlements",
"type": "array",
"required": "false"
}
],
"meta": {
"resourceType": "Schema",
"location": "/v2/Schemas/urn:sath:params:scim:schemas:core:1.0:Account"
},
"matching-attributes": [
"UserLogin"
],
"attribute-map": {
"fullName": {
"attribute": "DisplayName",
"type": "string"
},
"phone": {
"attribute": "PhoneNumber",
"type": "string"
},
"email": {
"attribute": "email",
"type": "string"
},
"UserLogin": {
"attribute": "UserLogin",
"type": "string"
},
"entitlements": {
"attribute": "entitlements",
"type": "array"
}
},
"configs": {
"uniqueKey": "UserLogin"
}
}
Where to place the updated file?
This file will be placed under the same folder location
/idhubfileconnector/configurations/schemas/Account.json
Setup Step 6: Start the connector application
Following are the steps which needs to be followed in order to achieve connector application running as a part of the system service, and will also run automatically on each system reboot
Step1:
This step involves keeping the connector application into a desired folder
for example : we are keeping the connector configurations under Connector folder under apps
/apps/DB-Connector
Step2:
We need to have a File-Connector.service file under like below
/etc/systemd/system/File-Connector.service
Step3:
Setup DB-Connector.service file
To setup this below are the exact content which needs to be there
[Unit]
Description=IDHUB File LINK Service
[Service]
User=root
# The configuration file application.properties should be here:
#change this to your workspace
WorkingDirectory=/apps/File-Connector
#path to executable.
#executable is a bash script which calls jar file
#ExecStart=/apps/File-connector/linker
Type=simple
ExecStart=/usr/bin/java -jar idhub-connector-application-1.0.0.jar
SuccessExitStatus=143
TimeoutStopSec=10
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
There are basically 2 things which needs to be configured here:
- WorkingDirectory= <needs to be the directory location where the File connector file is present >
- ExecStart= <.jar file can be changed accordingly as per the file inside File connector folder>
Step4:
Execute the below commands in sequence:
- Reload the service files to include the new service.
sudo systemctl daemon-reload
- Start your service
sudo systemctl start your-service.service
- To check the status of your service
sudo systemctl status example.service