Skip to content
This repository was archived by the owner on Dec 9, 2025. It is now read-only.

Commit 5599693

Browse files
author
sachin-maheshwari
authored
Merge pull request #2 from appirio-tech/dev
merge to prod testing
2 parents 49a6594 + 84df045 commit 5599693

File tree

177 files changed

+39753
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+39753
-1
lines changed

.circleci/config.yml

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
version: 2
2+
defaults: &defaults
3+
docker:
4+
- image: circleci/openjdk:8-jdk
5+
6+
install_dependency: &install_dependency
7+
name: Installation of build and deployment dependencies.
8+
command: |
9+
sudo apt update
10+
sudo apt install jq awscli python3-pip
11+
pip3 install awscli --upgrade --user
12+
#sudo apt install awscli
13+
14+
install_deploysuite_latest: &install_deploysuite_latest
15+
name: Installation of install_deploysuite.
16+
command: |
17+
git clone --branch v1.4.1 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
18+
cp ./../buildscript/master_deploy.sh .
19+
cp ./../buildscript/buildenv.sh .
20+
cp ./../buildscript/awsconfiguration.sh .
21+
22+
restore_cache_settings_for_build: &restore_cache_settings_for_build
23+
key: identity-service-{{ checksum "~/project/pom.xml" }}
24+
25+
save_cache_settings: &save_cache_settings
26+
paths:
27+
- ~/.m2
28+
key: identity-service-{{ checksum "~/project/pom.xml" }}
29+
30+
restore_cache_settings_for_core: &restore_cache_settings_for_core
31+
key: identity-service-{{ checksum "~/project/pom.xml" }}
32+
33+
save_cache_settings_core: &save_cache_settings_core
34+
paths:
35+
- ~/.m2
36+
key: identity-service-{{ checksum "~/project/pom.xml" }}
37+
38+
maven_configuration_v1: &maven_configuration_v1
39+
name: Configuring maven
40+
command: |
41+
MVNSERVERSETTING='<server>\n <id>tcrepo</id> \n <username>${env.MVNUSERNAME}</username> \n <password>${env.MVNPASSWD}</password> \n </server> '
42+
C=$(echo $MVNSERVERSETTING | sed 's/\//\\\//g')
43+
sudo sed -i.bak "/<\/servers>/ s/.*/${C}\n&/" /opt/apache-maven/conf/settings.xml
44+
MVNSERVERSETTING='<server>\n <id>tcreposnap</id> \n <username>${env.MVNUSERNAME}</username> \n <password>${env.MVNPASSWD}</password> \n </server> '
45+
C=$(echo $MVNSERVERSETTING | sed 's/\//\\\//g')
46+
sudo sed -i.bak "/<\/servers>/ s/.*/${C}\n&/" /opt/apache-maven/conf/settings.xml
47+
48+
restore_mvn_offline: &restore_mvn_offline
49+
name: maven restore go offline
50+
command: _JAVA_OPTIONS=-Djdk.net.URLClassPath.disableClassPathURLCheck=true mvn -f ~/project/pom.xml dependency:go-offline
51+
52+
restore_mvn_core_offline: &restore_mvn_core_offline
53+
name: maven restore core dependency go offline
54+
command: _JAVA_OPTIONS=-Djdk.net.URLClassPath.disableClassPathURLCheck=true mvn -f ~/project/pom.xml dependency:go-offline
55+
56+
update_test_result_path: &update_test_result_path
57+
name: Save test results
58+
command: |
59+
mkdir -p ~/junit/
60+
find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/junit/ \;
61+
when: always
62+
63+
store_test_output: &store_test_output
64+
path: ~/junit
65+
66+
maven_do_build: &maven_do_build
67+
name: Doing Maven Build
68+
command: |
69+
_JAVA_OPTIONS=-Djdk.net.URLClassPath.disableClassPathURLCheck=true mvn -f ~/project/pom.xml package
70+
71+
72+
build_deploy_steps: &build_deploy_steps
73+
# Initialization.
74+
- checkout
75+
- setup_remote_docker
76+
- run: *install_dependency
77+
- run: *install_deploysuite_latest
78+
- run:
79+
name: Build and AWS Configuration
80+
command: |
81+
./awsconfiguration.sh $DEPLOY_ENV
82+
./buildenv.sh -e $DEPLOY_ENV -b identity_common_var,identity_${LOGICAL_ENV}_buildvar,identity_ecs_${LOGICAL_ENV}_deployvar
83+
- run: *maven_configuration_v1
84+
- run:
85+
name: Build of token properties
86+
command: |
87+
source buildenvvar
88+
./buildtokenproperties.sh $DEPLOY_ENV
89+
- restore_cache: *restore_cache_settings_for_build
90+
- run: *restore_mvn_offline
91+
- save_cache: *save_cache_settings
92+
- run: *maven_do_build
93+
- run: *update_test_result_path
94+
- store_test_results: *store_test_output
95+
- store_artifacts: *store_test_output
96+
- run:
97+
name: Build Image
98+
command: |
99+
echo "Building image"
100+
./build/build-image.sh /home/circleci/project $LOGICAL_ENV
101+
- run:
102+
name: Deploying Application.
103+
command: |
104+
pwd
105+
source awsenvconf
106+
source buildenvvar
107+
# ./master_deploy.sh -d EBS -e $DEPLOY_ENV -t "${LOGICAL_ENV}.${VER}"
108+
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t "${LOGICAL_ENV}.${VER}" -s ${LOGICAL_ENV}_identity_ecs_appvar -i ap-identity-microservice
109+
110+
111+
jobs:
112+
# Build & Deploy against development backend
113+
"build-dev":
114+
<<: *defaults
115+
environment:
116+
DEPLOY_ENV: "DEV"
117+
LOGICAL_ENV: "dev"
118+
steps: *build_deploy_steps
119+
120+
# Build & Deploy against development backend
121+
"build-prod":
122+
<<: *defaults
123+
environment:
124+
DEPLOY_ENV: "PROD"
125+
LOGICAL_ENV: "prod"
126+
steps: *build_deploy_steps
127+
128+
129+
workflows:
130+
version: 2
131+
build:
132+
jobs:
133+
# Development builds are executed on "dev/develop" branch only.
134+
- "build-dev":
135+
context : org-global
136+
filters:
137+
branches:
138+
only: [dev, test]
139+
140+
# Production build is executed on "master" branch only.
141+
- "build-prod":
142+
context : org-global
143+
filters:
144+
branches:
145+
only: [master]
146+

README.md

Lines changed: 108 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,108 @@
1-
# identity-service
1+
## Verify get sub groups
2+
3+
### Setup
4+
5+
- Follow folder **docker/README.md** to setup the environment.
6+
- Execute the following sql against the mysql database(Authorization):
7+
- Execute the following sql against the informix database(common_oltp)
8+
9+
delete from user_sso_login where user_id in (1111, 2222);
10+
11+
delete from user where user_id in (1111, 2222);
12+
13+
insert into user (user_id, first_name, last_name, status, handle) values (1111, 'first 1', 'last 1', 'Active', 'heffan');
14+
15+
insert into user (user_id, first_name, last_name, status, handle) values (2222, 'first 2', 'last 2', 'Active', 'heffan2');
16+
17+
### Verify
18+
Import the `doc/groups` `api.postman_collection.json` into the `postman`, select `Service API Enhancement` folder and check each api.
19+
20+
For instance:
21+
`create or update user sso login record`
22+
23+
The response is:
24+
```json
25+
{
26+
"id": "26a88cec:161e9f08d1a:-7ffc",
27+
"result": {
28+
"success": true,
29+
"status": 200,
30+
"metadata": null,
31+
"content": {
32+
"userId": "externalUserId",
33+
"name": "first 3 last 3",
34+
"email": "heffan@tc.com",
35+
"providerType": null,
36+
"provider": "okta-customer",
37+
"context": null,
38+
"social": false,
39+
"enterprise": false,
40+
"emailVerified": false
41+
}
42+
},
43+
"version": "v3"
44+
}
45+
```
46+
`update user sso login record`
47+
48+
The response is:
49+
```json
50+
{
51+
"id": "26a88cec:161e9f08d1a:-7ff9",
52+
"result": {
53+
"success": true,
54+
"status": 200,
55+
"metadata": null,
56+
"content": {
57+
"userId": "externalUserId",
58+
"name": "first 3 last 3",
59+
"email": "heffan@tc.com",
60+
"providerType": null,
61+
"provider": "okta-customer",
62+
"context": null,
63+
"social": false,
64+
"enterprise": false,
65+
"emailVerified": false
66+
}
67+
},
68+
"version": "v3"
69+
}
70+
```
71+
72+
After create the user sso login record with two providers `sfdc-aspdev` and `okta-customer`,
73+
you can check `get user sso identifies by user id`, the response is:
74+
```json
75+
{
76+
"id": "26a88cec:161e9f08d1a:-7ff0",
77+
"result": {
78+
"success": true,
79+
"status": 200,
80+
"metadata": null,
81+
"content": [
82+
{
83+
"userId": "externalUserId",
84+
"name": "first 3 last 3",
85+
"email": "heffan@tc.com",
86+
"providerType": "samlp",
87+
"provider": "okta-customer",
88+
"context": null,
89+
"social": false,
90+
"enterprise": true,
91+
"emailVerified": false
92+
},
93+
{
94+
"userId": "externalUserId",
95+
"name": "first 3 last 3",
96+
"email": "heffan@tc.com",
97+
"providerType": "samlp",
98+
"provider": "sfdc-aspdev",
99+
"context": null,
100+
"social": false,
101+
"enterprise": true,
102+
"emailVerified": false
103+
}
104+
]
105+
},
106+
"version": "v3"
107+
}
108+
```
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"AWSTemplateFormatVersion" : "2010-09-09",
3+
4+
"Description" : "AWS CloudFormation template for creating ExternalAccounts table",
5+
6+
"Parameters" : {
7+
"ReadCapacityUnits" : {
8+
"Description" : "Provisioned read throughput",
9+
"Type" : "Number",
10+
"Default" : "1",
11+
"MinValue": "1",
12+
"MaxValue": "10000",
13+
"ConstraintDescription" : "must be between 5 and 10000"
14+
},
15+
16+
"WriteCapacityUnits" : {
17+
"Description" : "Provisioned write throughput",
18+
"Type" : "Number",
19+
"Default" : "1",
20+
"MinValue": "1",
21+
"MaxValue": "10000",
22+
"ConstraintDescription" : "must be between 5 and 10000"
23+
}
24+
},
25+
26+
"Resources" : {
27+
"ExternalAccounts" : {
28+
"Type" : "AWS::DynamoDB::Table",
29+
"Properties" : {
30+
"AttributeDefinitions": [ {
31+
"AttributeName" : "userId",
32+
"AttributeType" : "S"
33+
}, {
34+
"AttributeName" : "accountType",
35+
"AttributeType" : "S"
36+
}, {
37+
"AttributeName" : "synchronizedAt",
38+
"AttributeType" : "N"
39+
} ],
40+
"KeySchema": [
41+
{ "AttributeName": "userId", "KeyType": "HASH" },
42+
{ "AttributeName": "accountType", "KeyType": "RANGE" }
43+
],
44+
"GlobalSecondaryIndexes": [ {
45+
"IndexName": "synchronizedAt-index",
46+
"KeySchema": [
47+
{ "AttributeName": "synchronizedAt", "KeyType": "HASH" }
48+
],
49+
"Projection": {
50+
"ProjectionType": "ALL"
51+
},
52+
"ProvisionedThroughput": {
53+
"ReadCapacityUnits": { "Ref": "ReadCapacityUnits" },
54+
"WriteCapacityUnits": { "Ref": "WriteCapacityUnits" }
55+
}
56+
}],
57+
"ProvisionedThroughput" : {
58+
"ReadCapacityUnits" : {"Ref" : "ReadCapacityUnits"},
59+
"WriteCapacityUnits" : {"Ref" : "WriteCapacityUnits"}
60+
},
61+
"TableName" : "Externals.Accounts"
62+
}
63+
}
64+
},
65+
66+
"Outputs" : {
67+
"TableName" : {
68+
"Value" : {"Ref" : "ExternalAccounts"},
69+
"Description" : "Table name of the newly created DynamoDB table"
70+
}
71+
}
72+
}

0 commit comments

Comments
 (0)