Skip to content

Commit

Permalink
Merge pull request #82 from wso2/release-1.0.0-m1
Browse files Browse the repository at this point in the history
Update main to sync with m1
  • Loading branch information
SachiniSiriwardene authored Dec 12, 2024
2 parents c8c9cb8 + d3c64cb commit 34a40fa
Show file tree
Hide file tree
Showing 104 changed files with 5,791 additions and 374 deletions.
40 changes: 32 additions & 8 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Build and Release on Tag Push
on:
push:
tags:
- 'v*'
- 'v*'

permissions:
contents: write
contents: write

jobs:
build:
Expand Down Expand Up @@ -45,18 +45,42 @@ jobs:
uses: actions/download-artifact@v4
with:
name: dist-output
path: ./dist-output
path: ./dist-output

- name: Debug dist-output contents
run: ls -R ./dist-output
- name: Add required files and folders to each zip
run: |
# Create directories
mkdir -p ./release-artifacts ./temp-dir
# Process each file in dist-output
for file in ./dist-output/*; do
filename=$(basename "$file")
zipname="${filename}.zip"
# Clear temp-dir and recreate the developer-portal structure
rm -rf ./temp-dir/*
mkdir -p ./temp-dir/developer-portal
# Copy the additional files and folders into developer-portal
cp -r bin/startup.sh bin/startup.bat artifacts InstallationGuide.md QuickStart.md README.md config.json ./temp-dir/developer-portal/
# Move the current dist file into developer-portal
mv "$file" ./temp-dir/developer-portal/
# Zip everything inside developer-portal with its structure
(cd ./temp-dir && zip -r "../release-artifacts/$zipname" developer-portal > /dev/null)
done
- name: Debug release-artifacts contents
run: ls -R ./release-artifacts

- name: Create or Update GitHub Release
uses: ncipollo/release-action@v1
with:
tag: ${{ github.ref_name }}
tag: ${{ github.ref_name }}
name: WSO2 API Developer Portal Core ${{ github.ref_name }}
body: "WSO2 API Developer Portal Core serves as a development portal offering fundamental layout and structural components."
draft: false
prerelease: false
artifacts: "./dist-output/*"
allowUpdates: true
artifacts: "./release-artifacts/*"
allowUpdates: true
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# dependencies
/node_modules

/dist

/.pnp
Expand All @@ -16,7 +17,6 @@
# production
/build

/src/styles
/src/.tmp

/src/config/config.js
Expand Down
197 changes: 167 additions & 30 deletions QuickStart.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ Follow the steps given in InstallationGuide.md, to create database.

3. Execute the data-dump.sql script in the artifacts folder to populate the database with mock data.
```bash
psql -q -U "{db_username}" -d “test”_dump -h "{hostname}" -p "{port}" -f {path to data-dump.sql}
psql -q -U "{db_username}" -d “devportal" -h "{hostname}" -p "{port}" -f {path to data-dump.sql}
```
4. Execute the startup script on the root, based on the OS:

4. Execute the startup script on the <DEVPORTAL_HOME>/bin folder, based on the OS:
```bash
For Linux or MacOS
    sh startup.sh
Expand Down Expand Up @@ -248,9 +248,161 @@ After customizing the content, run “sh compress.sh {nameOfOrg}”, to create a
Follow the instructions in the [installation guide](https://docs.google.com/document/d/10bIEggNZmHy0oMLGBi_fsszXYYfcztaSt_p2i_3VcPo/edit?pli=1&tab=t.3roll6bfs18k) to setup the database and connect the devportal to it.
**Configure WSO2 as the control plane**
1. Create the IDP for devportal login
**Add claim mappings**
Go to claims->Add->Add new external claim
Dialect URI as http://wso2.org/oidc/claim.
External Clam URI : organizationID
Mapped Local Claim: http://wso2.org/claims/organization
Go to claims -> List -> http://wso2.org/oidc/claim.
Select roles and press edit.
For the Mapped Local Claim, select http://wso2.org/claims/role
**Add users and roles**
Create super admin role
Got Users and Roles -> Add -> Add new role.
Give a role name (superAdmin).
Select all permissions.
Click finish
Got Users and Roles -> Add -> Add user
Create a new user and assign superAdmin and admin role.
Create another user with Internal/subscriber permissions.
**Add claims to OIDC scopes**
Goto OIDC scopes->List.
Click on Add claims for openid.
Click Add OIDC claim
Select organizationID and roles as the claim uri
**Add Service Provider**
Goto Service Providers - > Add.
Give a name and click register.
Click on claim configuration and select Add claim URI
Add the following claims
|Service Provider Claim | Local Claim | Requested claim |
|:------------- |:------------: |-------------: |
| OrganizationID | http://wso2.org/claims/organization | true |
| Roles | http://wso2.org/claims/role | true |
| Username | http://wso2.org/claims/username | |
Select Username as the Subject Claim URI.
Under inbound authentication configuration, select Oauth and click configure.
Select code as the grant type.
Enter the following as the redirect URL:
regexp=(https://localhost:9443/devportal/services/auth/callback/login|https://localhost:9443/devportal/services/auth/callback/logout|http://localhost:3000/{ORGNAME}/callback|http://localhost:3000/{ORGNAME})
Select PKCE mandatory, Support PKCE 'Plain' Transform Algorithm, Renew Refresh Token and Allow authentication without the client secret.
Select JWT as the token issuer.
Click update.
**Update the config json**
```bash
"identityProvider" : {
"name": "<IDP_Name>",
"issuer": "<IDP_Issuer>,
"authorizationURL": "https://<IDP_DOMAIN>/oauth2/authorize",
"tokenURL": "https://<IDP_DOMAIN>/oauth2/token",
"userInfoURL": "https://<IDP_DOMAIN>/oauth2/userinfo",
"clientId": "<Clinet_ID>",
"callbackURL": "http://localhost:3000/ACME/callback",
"scope": "openid email groups",
"signUpURL": "<IDP_SignUP_URL>",
"logoutURL": "https://<IDP_DOMAIN>/oidc/logout",
"logoutRedirectURI": "http://localhost:3000/ACME"
},
"roleClaim": "roles",
"orgIDClaim": "organizationID",
"groupsClaim": "groups",
"adminRole": "admin",
"subscriberRole": "Interna/subscriber",
"superAdminRole": "superAdmin",
"authenticatedPages": [
"/*/configure",
"/portal",
"/*/applications",
"/*/applications/*",
"/*/myAPIs",
"/*/myAPIs/*"
],
"authorizedPages": [
"/*/applications",
"/*/applications/*",
"/*/configure",
"/portal",
"/*/myAPIs",
"/*/myAPIs/*"
]
````
API request for creating IDP in developer portal
``` bash
curl --location --request POST 'http://localhost:3000/devportal/organizations/{organizationID}/identityProvider' \
--header 'Content-Type: application/json' \
--header 'Cookie: connect.sid=s%3AhKQhm7b2bCe4RkJuFknvUsxVqgG_iueA.ddy6vv265vp0cRrpRoJMnYZWs11tRTNsT0MKtTyIQ4o' \
--data '{
"name": "<IDP_Name>",
"issuer": "<IDP_Issuer>",
"authorizationURL": "https://<IDP_DOMAIN>/oauth2/authorize",
"tokenURL": "https://<IDP_DOMAIN>/oauth2/token",
"userInfoURL": "https://<IDP_DOMAIN>/oauth2/userinfo",
"clientId": "<Clinet_ID>",
"callbackURL": "http://localhost:3000/ACME/callback",
"scope": "openid email groups",
"signUpURL": "<IDP_SignUP_URL>",
"logoutURL": "https://<IDP_DOMAIN>/oidc/logout",
"logoutRedirectURI": "http://localhost:3000/ACME"
}'
```
2. Configure APIM CP URL.
```bash
controlPlane : {
"url": "https://127.0.0.1:9443/api/am/devportal/v3"
}
```
3. Go to APIM publisher adn publish an API (https://localhost:9443/publisher)
4. Store the created API metadata in developer portal side, as mentioned in step 5 of the below section.
Follow the steps below to populate the organization’s content in the developer portal.
1. Create an organization in the developer portal.
Login to the developer portal using the credentials of the user with superAdmin role.
Navigate to 'http://localhost:3000/portal' and create the organization.
Enter the following information:
```bash
"orgName": "ACME",
"businessOwner": "John Doe",
"businessOwnerContact": "+94-76-123-456",
"businessOwnerEmail": "[email protected]",
"devPortalURLIdentifier": "myPortal", //customize URL for the devportal.
"roleClaimName": <claim name for the user roles>.
"groupsClaimName": <claim name for the user groups>.
"organizationClaimName": <claim name for the organization identifier>.
"organizationIdentifier": <value for the organization identifier>.
"adminRole": <admin role name>.
"subscriberRole": <subscriber role name>.
"superAdminRole": <super admin role name>
```
``` bash
curl --location --request POST 'http://localhost:3000/devportal/organizations'
Expand All @@ -266,16 +418,23 @@ curl --location --request POST 'http://localhost:3000/devportal/organizations'
2. Upload the generated zip with the organization content.
Login to the developer portal using the credentials of the user with superAdmin role.
Navigate to 'http://localhost:3000/{orgName}/configure' and upload the zip.
``` bash
curl --location --request PUT 'http://localhost:3000/devportal/organizations/{orgID}/layout'
curl --location --request POST 'http://localhost:3000/devportal/organizations/{orgID}/layout'
--form 'file=@{pathToZipFile}
```
3. Navigate to [http://localhost:3000/{orgName](http://localhost:3000/{orgName)}.
3. Click on configure IDP and add IDP details for the organization.
4. Navigate to [http://localhost:3000/{orgName](http://localhost:3000/{orgName)}.
The organization landing page will include the uploaded content.
The /apis page will render the page with no apis, since no API content is uploaded yet.Follow the steps below to populate the api details in the developer portal.
4. Create an API in the developer portal:
5. Create an API in the developer portal:
The apiType values include REST, AsyncAPI, GraphQL or SOAP
Expand All @@ -285,7 +444,7 @@ This is a multi part request containing a json with metadata related to the API
   --form 'api-metadata="{
                  "apiInfo": { 
                     "referenceID": "12344",
                     "referenceID": "<UUID for the API created in WSO2 publisher>",
                     "apiName": "NavigationAPI",
                     "orgName": "ACME",
                     "apiCategory": "Travel",
Expand Down Expand Up @@ -317,7 +476,7 @@ This is a multi part request containing a json with metadata related to the API
   --form 'apiDefinition=@"{apiDefinition.json}"'
```
5. Upload the api landing page content. 
6. Upload the api landing page content. 
To upload the content to be displayed on the api-landing page, create a zip file with the folder structure as follows:
``` bash
Expand Down Expand Up @@ -345,25 +504,3 @@ curl --location --request POST 'http://localhost:3000/devportal/organizations/{o
               \\"api-hero\\": \\"api.svg\\"
            }"
```
6. Create the IDP for devportal login
``` bash
curl --location --request POST 'http://localhost:3000/devportal/organizations/{organizationID}/identityProvider' \
--header 'Content-Type: application/json' \
--header 'Cookie: connect.sid=s%3AhKQhm7b2bCe4RkJuFknvUsxVqgG_iueA.ddy6vv265vp0cRrpRoJMnYZWs11tRTNsT0MKtTyIQ4o' \
--data '{
"name": "Asgardeo",
"issuer": "https://api.asgardeo.io/t/sachinisiriwardene/oauth2/token",
"authorizationURL": "https://api.asgardeo.io/t/sachinisiriwardene/oauth2/authorize",
"tokenURL": "https://api.asgardeo.io/t/sachinisiriwardene/oauth2/token",
"userInfoURL": "https://api.asgardeo.io/t/sachinisiriwardene/oauth2/userinfo",
"clientId": "",
"callbackURL": "http://localhost:3000/ACME/callback",
"scope": "openid email groups",
"signUpURL": "https://accounts.asgardeo.io/t/choreotestorganization/accountrecoveryendpoint/register.do",
"logoutURL": "https://api.asgardeo.io/t/sachinisiriwardene/oidc/logout",
"logoutRedirectURI": "http://localhost:3000/ACME"
}'
```
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Pre-requisites
Setup Guidelines
--------------
Follow the steps given in InstallationGuide.md, to create database.

Expand All @@ -11,7 +11,7 @@ Follow the steps given in InstallationGuide.md, to create database.
psql -q -U "{db_username}" -d "{db_name}" -h "{hostname}" -p "{port}" -f "{path to data-dump.sql}"
```

4. Execute the startup script on the root, based on the OS:
4. Execute the startup script <DEVPORTAL_HOME>/bin folder, based on the OS:

```bash
For Linux or MacOS
Expand All @@ -29,3 +29,8 @@ The ‘[http://localhost:3000/ACME](http://localhost:3000/{orgName})/apis’ wil
Each of the api landing and tryout pages are available at the following URLs:
'http://localhost:3000/ACME/api/{apiName}'
'http://localhost:3000/ACME/api/{apiName}/tryout'

Local Setup
--------------

To try the setup locally, please refer to the [API Developer Portal repository](https://github.com/wso2/api-developer-portal).
Loading

0 comments on commit 34a40fa

Please sign in to comment.