Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.0.0 #266

Merged
merged 29 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
944d3de
initial version
tejash-jl Dec 9, 2022
2ef5ac6
initial version
tejash-jl Dec 9, 2022
aaca954
added config for oauth properties
tejash-jl Jan 3, 2023
4c845d2
Merge branch 'main' into generic-auth
tejash-jl Jan 4, 2023
7f7bf93
moved auth functionalities to middleware module
tejash-jl Jan 4, 2023
bb0d06d
created a generic spi to support any identity provider
tejash-jl Jan 10, 2023
de01ccc
updated yaml file
tejash-jl Jan 10, 2023
0a44b49
Merge branch 'main' into generic-auth
tejash-jl Jun 13, 2023
5091ecf
- Add auth0 provider implementation
tejash-jl Jun 20, 2023
bdf1deb
Merge branch 'main' into generic-auth
tejash-jl Jun 20, 2023
f8bb150
Fix failing test cases
tejash-jl Jun 20, 2023
8be0523
Add generic iam module
tejash-jl Jun 27, 2023
50f52a1
Add sample fusionauth iam support service
tejash-jl Jun 27, 2023
969c761
Merge branch 'main' into generic-auth
tejash-jl Jun 27, 2023
9072b19
Add dockerfile to sample fusion auth service
tejash-jl Jun 27, 2023
97c485e
Add missed out files in previous commit
tejash-jl Jun 27, 2023
76c9647
Fix failing test cases
tejash-jl Jun 27, 2023
bb290c9
Add e2e tests for fusionauth identity provider
tejash-jl Jun 27, 2023
61ac6e8
Update env params
tejash-jl Jun 27, 2023
6a99ab9
Revert application.yml changes
tejash-jl Jun 27, 2023
b84204d
Merge branch 'release-1.0.0' into generic-auth
tejash-jl Jun 30, 2023
27c4715
Remove keycloak dependency in registry
tejash-jl Jun 30, 2023
f033fda
Merge branch 'main' into generic-auth
tejash-jl Jul 1, 2023
095c09d
Merge pull request #230 from Sunbird-RC/generic-auth
srprasanna Jul 4, 2023
cf8cab3
Merge branch 'main' into release-1.0.0
holashchand Nov 7, 2023
b679e78
Resolved merge issues
holashchand Nov 8, 2023
a2e316e
Merge branch 'main' into release-1.0.0
holashchand Nov 9, 2023
4a65676
Merge pull request #264 from holashchand/release-1.0.0
srprasanna Nov 9, 2023
8a10773
Merge branch 'main' into release-1.0.0
srprasanna Nov 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ node {


stage('Push image') {
docker.withRegistry('', 'dockerhub') {
docker.withRegistry('ghcr.io', 'sunbird-rc') {
app.push("${env.BUILD_NUMBER}")
app.push("latest")
}
docker.withRegistry('', 'dockerhub') {
docker.withRegistry('ghrc.io', 'sunbird-rc') {
claimApp.push("${env.BUILD_NUMBER}")
claimApp.push("latest")
}
Expand Down
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ test: build
@cd java/apitest && MODE=async ../mvnw -Pe2e test
@docker-compose down
@rm -rf db-data-2 || echo "no permission to delete"
# test with fusionauth
@docker-compose --env-file test_environments/test_with_fusionauth.env -f docker-compose.yml -f services/sample-fusionauth-service/docker-compose.yml up -d db es fusionauth fusionauthwrapper
sleep 20
@echo "Starting the test" && sh build/wait_for_port.sh 9011
@echo "Starting the test" && sh build/wait_for_port.sh 3990
sleep 20
@docker-compose --env-file test_environments/test_with_fusionauth.env -f docker-compose.yml -f services/sample-fusionauth-service/docker-compose.yml up -d --no-deps registry
@echo "Starting the test" && sh build/wait_for_port.sh 8081
@docker-compose -f docker-compose.yml -f services/sample-fusionauth-service/docker-compose.yml ps
@curl -v http://localhost:8081/health
@cd java/apitest && MODE=fusionauth ../mvnw -Pe2e test || echo 'Tests failed'
@docker-compose -f docker-compose.yml -f services/sample-fusionauth-service/docker-compose.yml down
@rm -rf db-data-3 || echo "no permission to delete"
make -C services/certificate-signer test
make -C services/public-key-service test
make -C services/context-proxy-service test
Expand Down
7 changes: 6 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ services:
- elastic_search_password=${ELASTIC_SEARCH_PASSWORD}
- search_providerName=${SEARCH_PROVIDER_NAME-dev.sunbirdrc.registry.service.NativeSearchService}
- sunbird_sso_realm=${KEYCLOAK_REALM-sunbird-rc}
- sunbird_sso_url=http://keycloak:8080/auth
- sunbird_sso_url=${sunbird_sso_url-http://keycloak:8080/auth}
- oauth2_resource_uri=${oauth2_resource_uri-http://keycloak:8080/auth/realms/sunbird-rc}
- oauth2_resource_roles_path=${oauth2_resource_roles_path-realm_access.roles}
- identity_provider=${identity_provider-dev.sunbirdrc.auth.keycloak.KeycloakProviderImpl}
- sunbird_sso_admin_client_id=${KEYCLOAK_ADMIN_CLIENT_ID-admin-api}
- sunbird_sso_client_id=${KEYCLOAK_CLIENT_ID-registry-frontend}
- sunbird_sso_admin_client_secret=${KEYCLOAK_SECRET}
Expand Down Expand Up @@ -99,6 +102,8 @@ services:
depends_on:
db:
condition: service_healthy
keycloak:
condition: service_healthy
healthcheck:
test:
[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"userDetails": {
"passkey": "abcd"
"passkey": "abcd@12345"
},
"contactDetails": {
"mobile": "9876543210",
"email": "[email protected]"
}
}
}
3 changes: 3 additions & 0 deletions java/apitest/src/test/java/e2e/registry/certificate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Feature: Get certificate pdf
Background:
* def certUrl = "http://localhost:8078"
* def templateBody = {"certificate": "{\"name\":\"Test Name\", \"dob\":\"2002-12-22\"}","templateUrl": "http://registry:8081/api/v1/templates/Student.html"}

@envnot=fusionauth
Scenario:
And header Accept = 'application/pdf'
Given url certUrl
Expand All @@ -11,6 +13,7 @@ Feature: Get certificate pdf
Then status 200
#* print response

@envnot=fusionauth
Scenario:
And header Accept = 'application/pdf'
Given url certUrl
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Feature: Registry api tests
Background:
* string registryUrl = "http://localhost:8081"
* string authUrl = "http://localhost:9011"
* url registryUrl
* def admin_token = ""
* def client_secret = 'a52c5f4a-89fd-40b9-aea2-3f711f14c889'
* def sleep = function(millis){ java.lang.Thread.sleep(millis) }
@env=fusionauth
Scenario: Create student with password schema and verify if password is set
# get admin token
* url authUrl
* path '/oauth2/token'
* header Content-Type = 'application/x-www-form-urlencoded; charset=utf-8'
* header Host = 'fusionauth:9011'
* form field grant_type = 'password'
* form field client_id = '85a03867-dccf-4882-adde-1a79aeec50df'
* form field username = '[email protected]'
* form field password = 'admin@12345'
* method post
Then status 200
And print response.access_token
* def admin_token = 'Bearer ' + response.access_token
# create student schema
Given url registryUrl
And path 'api/v1/Schema'
And header Authorization = admin_token
And request read('StudentWithPasswordSchemaRequest.json')
When method post
Then status 200
And response.params.status == "SUCCESSFUL"
# invite entity for student
Given url registryUrl
And path 'api/v1/StudentWithPassword/invite'
* def studentRequest = read('StudentWithPasswordRequest.json')
And request studentRequest
When method post
Then status 200
* def studentOsid = response.result.StudentWithPassword.osid
# get student token
* url authUrl
* path '/oauth2/token'
* header Content-Type = 'application/x-www-form-urlencoded; charset=utf-8'
* header Host = 'fusionauth:9011'
* form field grant_type = 'password'
* form field client_id = '85a03867-dccf-4882-adde-1a79aeec50df'
* form field username = studentRequest.contactDetails.mobile
* form field password = studentRequest.userDetails.passkey
* method post
Then status 200
And print response.access_token
* def student_token = 'Bearer ' + response.access_token
* sleep(3000)
# get student info
Given url registryUrl
And path 'api/v1/StudentWithPassword/'
And header Authorization = student_token
When method get
Then status 200
And response[0].osid.length > 0
12 changes: 9 additions & 3 deletions java/apitest/src/test/java/e2e/registry/registry.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ Feature: Registry api tests
* def admin_token = ""
* def client_secret = 'a52c5f4a-89fd-40b9-aea2-3f711f14c889'
* def sleep = function(millis){ java.lang.Thread.sleep(millis) }

@envnot=fusionauth
Scenario: health check
Given path 'health'
When method get
Then status 200

@envnot=fusionauth
Scenario: Create birth certificate schema and issue credentials
# get admin token
* url authUrl
Expand Down Expand Up @@ -102,7 +102,7 @@ Feature: Registry api tests
And response.params.status == "UNSUCCESSFUL"
And response.params.errmsg == "entity status is inactive"


@envnot=fusionauth
Scenario: Create student schema and verify crud apis
# get admin token
* url authUrl
Expand Down Expand Up @@ -234,6 +234,7 @@ Feature: Registry api tests
And response.length == 1
And response[0].contact == '#notpresent'

@envnot=fusionauth
Scenario: Create Board and invite institutes
# get admin token
* url authUrl
Expand Down Expand Up @@ -347,6 +348,7 @@ Feature: Registry api tests
And assert response[0].address[0].phoneNo.length == 1
And assert response[0].address[0].phoneNo[0] == "444"

@envnot=fusionauth
Scenario: write a api test, to test the schema not found error
# get admin token
* url authUrl
Expand Down Expand Up @@ -486,6 +488,7 @@ Feature: Registry api tests
And response.params.status =="UNSUCCESSFUL"
And response.params.errmsg == "Schema 'Teacher1' not found"

@envnot=fusionauth
Scenario: Create student with password schema and verify if password is set
# get admin token
* url authUrl
Expand Down Expand Up @@ -544,6 +547,8 @@ Feature: Registry api tests
When method get
Then status 200
* match response.contactDetails == { mobile: '#notpresent', email: '#present', osid: '#present' }

@envnot=fusionauth
Scenario: Create birth certificate schema, issue credentials then revoke the credential and check for CRUD APIS
# get admin token
* url authUrl
Expand Down Expand Up @@ -678,6 +683,7 @@ Feature: Registry api tests
And print response[notificationStudent]
And assert response[notificationStudent] != null

@envnot=fusionauth
Scenario: Test unique constraints with nested and composite fields
# create entity
Given url registryUrl
Expand Down
4 changes: 3 additions & 1 deletion java/middleware/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

Expand Down
76 changes: 76 additions & 0 deletions java/middleware/registry-middleware/auth0/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>registry-middleware</artifactId>
<groupId>dev.sunbirdrc</groupId>
<version>2.0.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>auth0</artifactId>

<dependencyManagement>
<dependencies>

</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>auth0</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.32</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.3.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>dev.sunbirdrc</groupId>
<artifactId>pojos</artifactId>
<version>2.0.3</version>
</dependency>
<dependency>
<groupId>dev.sunbirdrc</groupId>
<artifactId>middleware-commons</artifactId>
<version>2.0.3</version>
</dependency>
<dependency>
<groupId>dev.sunbirdrc</groupId>
<artifactId>identity-provider</artifactId>
<version>2.0.3</version>
</dependency>

</dependencies>
</project>
Loading